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.
This commit is contained in:
2026-03-13 12:51:26 -04:00
parent 3e292f18c8
commit 557ac77458
+5 -15
View File
@@ -7,21 +7,11 @@ const WOOD_INIT_STORAGE_KEY = "wood-paneling";
(function () {
const woodPaneling = localStorage.getItem(WOOD_INIT_STORAGE_KEY) || "none";
if (woodPaneling !== "none") {
const applyPaneling = () => {
const container = document.getElementById("collections-container");
if (container) {
container.classList.add(`bg-${woodPaneling}`);
container.setAttribute("data-wood", woodPaneling);
document.body.classList.add(`bg-${woodPaneling}`);
}
};
// Apply immediately if DOM is ready, otherwise wait
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", applyPaneling);
} else {
applyPaneling();
const container = document.getElementById("collections-container");
if (container) {
container.classList.add(`bg-${woodPaneling}`);
container.setAttribute("data-wood", woodPaneling);
document.body.classList.add(`bg-${woodPaneling}`);
}
}
})();