Switch to module init function pattern
| @@ -6750,9 +6750,6 @@ | |||
| 6750 | <script type="module" src="lib/swiped-events.js"></script> | 6750 | <script type="module" src="lib/swiped-events.js"></script> |
| 6751 | <script type="module" src="lib/eventemitter.js"></script> | 6751 | <script type="module" src="lib/eventemitter.js"></script> |
| 6752 | <script type="module" src="scripts/i18n.js"></script> | 6752 | <script type="module" src="scripts/i18n.js"></script> |
| 6753 | <script type="module" src="scripts/bulk-edit.js"></script> | ||
| 6754 | <script type="module" src="scripts/setting-search.js"></script> | ||
| 6755 | <script type="module" src="scripts/server-history.js"></script> | ||
| 6756 | <script type="module" src="script.js"></script> | 6753 | <script type="module" src="script.js"></script> |
| 6757 | <script> | 6754 | <script> |
| 6758 | window.addEventListener('load', (event) => { | 6755 | window.addEventListener('load', (event) => { |
| @@ -264,6 +264,9 @@ import { registerExtensionSlashCommands as initExtensionSlashCommands } from './ | |||
| 264 | import { ToolManager } from './scripts/tool-calling.js'; | 264 | import { ToolManager } from './scripts/tool-calling.js'; |
| 265 | import { addShowdownPatch } from './scripts/util/showdown-patch.js'; | 265 | import { addShowdownPatch } from './scripts/util/showdown-patch.js'; |
| 266 | import { applyBrowserFixes } from './scripts/browser-fixes.js'; | 266 | import { applyBrowserFixes } from './scripts/browser-fixes.js'; |
| 267 | import { initServerHistory } from './scripts/server-history.js'; | ||
| 268 | import { initSettingsSearch } from './scripts/setting-search.js'; | ||
| 269 | import { initBulkEdit } from './scripts/bulk-edit.js'; | ||
| 267 | 270 | ||
| 268 | //exporting functions and vars for mods | 271 | //exporting functions and vars for mods |
| 269 | export { | 272 | export { |
| @@ -965,6 +968,9 @@ async function firstLoadInit() { | |||
| 965 | initCfg(); | 968 | initCfg(); |
| 966 | initLogprobs(); | 969 | initLogprobs(); |
| 967 | initInputMarkdown(); | 970 | initInputMarkdown(); |
| 971 | initServerHistory(); | ||
| 972 | initSettingsSearch(); | ||
| 973 | initBulkEdit(); | ||
| 968 | await initScrapers(); | 974 | await initScrapers(); |
| 969 | doDailyExtensionUpdatesCheck(); | 975 | doDailyExtensionUpdatesCheck(); |
| 970 | await hideLoader(); | 976 | await hideLoader(); |
| @@ -30,11 +30,6 @@ const toggleBulkEditMode = (isBulkEdit) => { | |||
| 30 | } | 30 | } |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | characterGroupOverlay.addStateChangeCallback((state) => { | ||
| 34 | if (state === BulkEditOverlayState.select) enableBulkEdit(); | ||
| 35 | if (state === BulkEditOverlayState.browse) disableBulkEdit(); | ||
| 36 | }); | ||
| 37 | |||
| 38 | /** | 33 | /** |
| 39 | * Toggles bulk edit mode on/off when the edit button is clicked. | 34 | * Toggles bulk edit mode on/off when the edit button is clicked. |
| 40 | */ | 35 | */ |
| @@ -117,8 +112,13 @@ function disableBulkSelect() { | |||
| 117 | /** | 112 | /** |
| 118 | * Entry point that runs on page load. | 113 | * Entry point that runs on page load. |
| 119 | */ | 114 | */ |
| 120 | jQuery(() => { | 115 | export function initBulkEdit() { |
| 116 | characterGroupOverlay.addStateChangeCallback((state) => { | ||
| 117 | if (state === BulkEditOverlayState.select) enableBulkEdit(); | ||
| 118 | if (state === BulkEditOverlayState.browse) disableBulkEdit(); | ||
| 119 | }); | ||
| 120 | |||
| 121 | $('#bulkEditButton').on('click', onEditButtonClick); | 121 | $('#bulkEditButton').on('click', onEditButtonClick); |
| 122 | $('#bulkSelectAllButton').on('click', onSelectAllButtonClick); | 122 | $('#bulkSelectAllButton').on('click', onSelectAllButtonClick); |
| 123 | $('#bulkDeleteButton').on('click', onDeleteButtonClick); | 123 | $('#bulkDeleteButton').on('click', onDeleteButtonClick); |
| 124 | }); | 124 | } |
| @@ -80,7 +80,7 @@ function onServerConnectClick() { | |||
| 80 | }); | 80 | }); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | jQuery(function () { | 83 | export function initServerHistory() { |
| 84 | $('[data-server-history]').each(createServerAutocomplete); | 84 | $('[data-server-history]').each(createServerAutocomplete); |
| 85 | $(document).on('click', '[data-server-connect]', onServerConnectClick); | 85 | $(document).on('click', '[data-server-connect]', onServerConnectClick); |
| 86 | }); | 86 | } |
| @@ -49,6 +49,6 @@ function removeHighlighting() { | |||
| 49 | $('.highlighted').removeClass('highlighted'); // Remove CSS class from previously highlighted elements | 49 | $('.highlighted').removeClass('highlighted'); // Remove CSS class from previously highlighted elements |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | jQuery(() => { | 52 | export function initSettingsSearch() { |
| 53 | $('#settingsSearch').on('input change', searchSettings); | 53 | $('#settingsSearch').on('input change', searchSettings); |
| 54 | }); | 54 | } |