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.
18 lines
647 B
TypeScript
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}`);
|
|
}
|
|
}
|
|
})();
|