Files
bookhoard/web/src/woodPanelingInit.ts
T
john-okeefe 557ac77458 refactor(woodPanelingInit): simplify by removing DOMContentLoaded check
Since main.js has 'defer', the script executes after DOM is parsed.
The DOMContentLoaded check was unnecessary - the else branch always
executes. Simplified to just run immediately.
2026-03-13 12:51:26 -04:00

18 lines
647 B
TypeScript

// Early initialization script to prevent flash of wrong background
// Loads before woodPaneling.js to apply paneling immediately
const WOOD_INIT_STORAGE_KEY = "wood-paneling";
// Apply wood paneling immediately (before DOM ready if possible)
(function () {
const woodPaneling = localStorage.getItem(WOOD_INIT_STORAGE_KEY) || "none";
if (woodPaneling !== "none") {
const container = document.getElementById("collections-container");
if (container) {
container.classList.add(`bg-${woodPaneling}`);
container.setAttribute("data-wood", woodPaneling);
document.body.classList.add(`bg-${woodPaneling}`);
}
}
})();