diff --git a/web/src/collections.ts b/web/src/collections.ts index 68ea040..b5f177a 100644 --- a/web/src/collections.ts +++ b/web/src/collections.ts @@ -199,12 +199,6 @@ function setupHTMXAuth(): void { (evt as any).detail.headers["Authorization"] = `Bearer ${token}`; }); } -// Auto-initialize HTMX auth when DOM is ready -if (document.readyState === "loading") { - document.addEventListener("DOMContentLoaded", setupHTMXAuth); -} else { - setupHTMXAuth(); -} function navigateToCollection(element: HTMLElement): void { // Check if the click target is a button @@ -288,13 +282,6 @@ function initColorSelection(): void { }); } -// Auto-initialize when DOM is ready -if (document.readyState === "loading") { - document.addEventListener("DOMContentLoaded", initColorSelection); -} else { - initColorSelection(); -} - // Initialize icon grid when modal is loaded via HTMX function setupHTMXModalInit(): void { document.body.addEventListener("htmx:afterSwap", function (evt: Event) { @@ -304,12 +291,6 @@ function setupHTMXModalInit(): void { } }); } -// Auto-initialize when DOM is ready -if (document.readyState === "loading") { - document.addEventListener("DOMContentLoaded", setupHTMXModalInit); -} else { - setupHTMXModalInit(); -} // Icon data with keywords (single source of truth) const iconData: Record = { @@ -446,6 +427,7 @@ export { selectIcon, showAddBooksModal, showAllIcons, + setupHTMXAuth, testRule, toggleBookForRemoval, toggleBookSelection,