| 614 | 614 | return scripts.filter(script => selectedIds.includes(script.id)); |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | + $('#bulk_select_all_toggle').on('click', async function () { |
| 618 | + const checkboxes = $('#regex_container .regex_bulk_checkbox'); |
| 619 | + if (checkboxes.length === 0) { |
| 620 | + return; |
| 621 | + } |
| 622 | + |
| 623 | + const allAreChecked = checkboxes.length === checkboxes.filter(':checked').length; |
| 624 | + const newState = !allAreChecked; // true if we just checked all, false if we just unchecked all |
| 625 | + |
| 626 | + checkboxes.prop('checked', newState); |
| 627 | + |
| 628 | + const icon = $(this).find('i'); |
| 629 | + // Toggle the icon shapes |
| 630 | + icon.toggleClass('fa-check-double', !newState); // Add 'fa-square-check' when deselected |
| 631 | + icon.toggleClass('fa-minus', newState); // Add 'fa-square-minus' when selected |
| 632 | + }); |
| 633 | + |
| 617 | 634 | $('#bulk_enable_regex').on('click', async function () { |
| 618 | 635 | const scripts = getSelectedScripts().filter(script => script.disabled); |
| 619 | 636 | if (scripts.length === 0) { |