-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathtoggleCheckboxes.js
More file actions
66 lines (53 loc) · 1.84 KB
/
toggleCheckboxes.js
File metadata and controls
66 lines (53 loc) · 1.84 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
/**
* ChatGPT Bulk Delete - Toggle Checkboxes Operation
*
* This script toggles all visible checkboxes on/off.
* 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('[ToggleCheckboxes] Core system not ready, deferring execution');
setTimeout(arguments.callee, 50);
return;
}
const core = window.ChatGPTBulkDelete;
const utils = core.utils;
utils.debug('ToggleCheckboxes script loaded');
/**
* Main function to toggle all checkboxes
*/
function toggleAllCheckboxes() {
return core.executeOperation('toggleCheckboxes', () => {
utils.log('log', 'Starting checkbox toggle operation');
// Get CheckboxManager module
const CheckboxManager = core.getModule('CheckboxManager');
if (!CheckboxManager) {
throw new Error('CheckboxManager module not available');
}
// Use CheckboxManager to toggle all checkboxes
const toggledCount = CheckboxManager.toggleAllCheckboxes();
const result = {
success: true,
toggledCount: toggledCount,
message: toggledCount > 0
? `Successfully toggled ${toggledCount} checkboxes`
: 'No checkboxes found to toggle'
};
utils.log('log', result.message);
return result;
});
}
// Execute the operation
try {
toggleAllCheckboxes();
} catch (error) {
utils.log('error', 'Failed to execute toggleCheckboxes operation:', error);
// Show user notification if possible
const CommonUtils = core.getModule('CommonUtils');
if (CommonUtils && CommonUtils.showNotification) {
CommonUtils.showNotification(`Failed to toggle checkboxes: ${error.message}`, 'error');
}
}
})();