fix inits

This commit is contained in:
MLH
2024-12-22 02:23:48 +01:00
parent d5c697afdf
commit 65a5753f59
9 changed files with 79 additions and 46 deletions

View File

@ -109,12 +109,16 @@ function initChristmas() {
}
}
// initialize christmas and add random christmas symbols after the DOM is loaded
if (!christmas) return; // exit if christmas is disabled
initChristmas();
toggleChristmas();
// initialize christmas and add random christmas symbols
function initializeChristmas() {
if (!christmas) return; // exit if christmas is disabled
initChristmas();
toggleChristmas();
const screenWidth = window.innerWidth; // get the screen width to detect mobile devices
if (randomChristmas && (screenWidth > 768 || randomChristmasMobile)) { // add random christmas only on larger screens, unless enabled for mobile devices
addRandomChristmas(christmasCount);
const screenWidth = window.innerWidth; // get the screen width to detect mobile devices
if (randomChristmas && (screenWidth > 768 || randomChristmasMobile)) { // add random christmas only on larger screens, unless enabled for mobile devices
addRandomChristmas(christmasCount);
}
}
initializeChristmas();