-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathremoveCheckboxes.js
More file actions
67 lines (53 loc) · 1.95 KB
/
removeCheckboxes.js
File metadata and controls
67 lines (53 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* ChatGPT Bulk Delete - Remove Checkboxes Operation
*
* This script removes all checkboxes and reloads the page.
* It uses the CheckboxManager module for the actual implementation.
*/
(function() {
'use strict';
// Wait for core system to be ready
if (!window.ChatGPTBulkDelete || !window.ChatGPTBulkDelete.initialized) {
console.error('[RemoveCheckboxes] Core system not ready, deferring execution');
setTimeout(arguments.callee, 50);
return;
}
const core = window.ChatGPTBulkDelete;
const utils = core.utils;
utils.debug('RemoveCheckboxes script loaded');
/**
* Main function to remove all checkboxes and reload page
*/
function removeCheckboxesAndReload() {
return core.executeOperation('removeCheckboxes', () => {
utils.log('log', 'Starting checkbox removal operation');
// Get CheckboxManager module
const CheckboxManager = core.getModule('CheckboxManager');
if (!CheckboxManager) {
throw new Error('CheckboxManager module not available');
}
// Use CheckboxManager to remove all checkboxes
const removedCount = CheckboxManager.removeAllCheckboxes();
utils.log('log', `Removed ${removedCount} checkboxes, reloading page`);
// Reload the page to restore original state
location.reload();
// This return won't actually execute due to page reload, but included for completeness
return {
success: true,
removedCount: removedCount,
reloaded: true
};
});
}
// Execute the operation
try {
removeCheckboxesAndReload();
} catch (error) {
utils.log('error', 'Failed to execute removeCheckboxes operation:', error);
// Show user notification if possible
const CommonUtils = core.getModule('CommonUtils');
if (CommonUtils && CommonUtils.showNotification) {
CommonUtils.showNotification(`Failed to remove checkboxes: ${error.message}`, 'error');
}
}
})();