diff --git a/seasonals/autumn.js b/seasonals/autumn.js index 5dfdecb..46f5aa2 100644 --- a/seasonals/autumn.js +++ b/seasonals/autumn.js @@ -136,13 +136,11 @@ function initLeaves() { } // initialize leaves and add random leaves after the DOM is loaded -document.addEventListener('DOMContentLoaded', () => { - if (!leaves) return; // exit if leaves are disabled - initLeaves(); - toggleAutumn(); +if (!leaves) return; // exit if leaves are disabled +initLeaves(); +toggleAutumn(); - const screenWidth = window.innerWidth; // get the screen width to detect mobile devices - if (randomLeaves && (screenWidth > 768 || randomLeavesMobile)) { // add random leaves only on larger screens, unless enabled for mobile devices - addRandomLeaves(leafCount); - } -}); \ No newline at end of file +const screenWidth = window.innerWidth; // get the screen width to detect mobile devices +if (randomLeaves && (screenWidth > 768 || randomLeavesMobile)) { // add random leaves only on larger screens, unless enabled for mobile devices + addRandomLeaves(leafCount); +} diff --git a/seasonals/christmas.js b/seasonals/christmas.js index d3e467e..fc0d43b 100644 --- a/seasonals/christmas.js +++ b/seasonals/christmas.js @@ -110,13 +110,11 @@ function initChristmas() { } // initialize christmas and add random christmas symbols after the DOM is loaded -document.addEventListener('DOMContentLoaded', () => { - if (!christmas) return; // exit if christmas is disabled - initChristmas(); - toggleChristmas(); +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); - } -}); \ No newline at end of file +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); +} diff --git a/seasonals/fireworks.js b/seasonals/fireworks.js index 8fdba14..5dd8688 100644 --- a/seasonals/fireworks.js +++ b/seasonals/fireworks.js @@ -114,7 +114,7 @@ function launchFirework() { fireworkContainer.className = "fireworks"; fireworkContainer.setAttribute("aria-hidden", "true"); document.body.appendChild(fireworkContainer); - } + } // Random horizontal position const x = Math.random() * window.innerWidth; // Any value across the entire width @@ -152,8 +152,6 @@ function startFireworks() { } // Initialize fireworks and add random fireworks after the DOM is loaded -document.addEventListener('DOMContentLoaded', () => { - if (!fireworks) return; // exit if fireworks are disabled - startFireworks(); - toggleFirework(); -}); +if (!fireworks) return; // exit if fireworks are disabled +startFireworks(); +toggleFirework(); diff --git a/seasonals/halloween.js b/seasonals/halloween.js index 2be049a..4d6f1ec 100644 --- a/seasonals/halloween.js +++ b/seasonals/halloween.js @@ -123,13 +123,11 @@ function createHalloween() { } // initialize halloween after the DOM is loaded -document.addEventListener('DOMContentLoaded', () => { - if (!halloween) return; // exit if halloween is disabled - createHalloween(); - toggleHalloween(); +if (!halloween) return; // exit if halloween is disabled +createHalloween(); +toggleHalloween(); - const screenWidth = window.innerWidth; // get the screen width to detect mobile devices - if (randomSymbols && (screenWidth > 768 || randomSymbolsMobile)) { // add random halloweens only on larger screens, unless enabled for mobile devices - addRandomSymbols(halloweenCount); - } -}); +const screenWidth = window.innerWidth; // get the screen width to detect mobile devices +if (randomSymbols && (screenWidth > 768 || randomSymbolsMobile)) { // add random halloweens only on larger screens, unless enabled for mobile devices + addRandomSymbols(halloweenCount); +} diff --git a/seasonals/hearts.js b/seasonals/hearts.js index fd59d3f..ac3c0cc 100644 --- a/seasonals/hearts.js +++ b/seasonals/hearts.js @@ -112,13 +112,11 @@ function createHearts() { // initialize hearts after the DOM is loaded -document.addEventListener('DOMContentLoaded', () => { - if (!hearts) return; // exit if hearts is disabled - createHearts(); - toggleHearts(); +if (!hearts) return; // exit if hearts is disabled +createHearts(); +toggleHearts(); - const screenWidth = window.innerWidth; // get the screen width to detect mobile devices - if (randomSymbols && (screenWidth > 768 || randomSymbolsMobile)) { // add random heartss only on larger screens, unless enabled for mobile devices - addRandomSymbols(heartsCount); - } -}); +const screenWidth = window.innerWidth; // get the screen width to detect mobile devices +if (randomSymbols && (screenWidth > 768 || randomSymbolsMobile)) { // add random heartss only on larger screens, unless enabled for mobile devices + addRandomSymbols(heartsCount); +} diff --git a/seasonals/snowfall.js b/seasonals/snowfall.js index c9c55b2..23b09bd 100644 --- a/seasonals/snowfall.js +++ b/seasonals/snowfall.js @@ -80,27 +80,25 @@ function animateSnowflake(snowflake) { const sidewaysMovement = Math.random() * 2 - 1; function fall() { - const currentTop = parseFloat(snowflake.style.top || 0); - const currentLeft = parseFloat(snowflake.style.left || 0); + const currentTop = parseFloat(snowflake.style.top || 0); + const currentLeft = parseFloat(snowflake.style.left || 0); - // fall and sideways movement - snowflake.style.top = `${currentTop + speed}px`; - snowflake.style.left = `${currentLeft + sidewaysMovement}px`; + // fall and sideways movement + snowflake.style.top = `${currentTop + speed}px`; + snowflake.style.left = `${currentLeft + sidewaysMovement}px`; - // if snowflake is out of the window, reset its position - if (currentTop > window.innerHeight) { - snowflake.style.top = '0px'; - snowflake.style.left = `${Math.random() * window.innerWidth}px`; - } + // if snowflake is out of the window, reset its position + if (currentTop > window.innerHeight) { + snowflake.style.top = '0px'; + snowflake.style.left = `${Math.random() * window.innerWidth}px`; + } - requestAnimationFrame(fall); + requestAnimationFrame(fall); } fall(); } // initialize snowfall after the DOM is loaded -document.addEventListener('DOMContentLoaded', () => { - if (!snowfall) return; // exit if snowfall is disabled - createSnowflakes(); -}); +if (!snowfall) return; // exit if snowfall is disabled +createSnowflakes(); diff --git a/seasonals/snowflakes.js b/seasonals/snowflakes.js index a3d3dc9..dbb4f9c 100644 --- a/seasonals/snowflakes.js +++ b/seasonals/snowflakes.js @@ -118,13 +118,11 @@ function initSnowflakes() { } // initialize snowflakes and add random snowflakes after the DOM is loaded -document.addEventListener('DOMContentLoaded', () => { - if (!snowflakes) return; // exit if snowflakes are disabled - initSnowflakes(); - toggleSnowflakes(); +if (!snowflakes) return; // exit if snowflakes are disabled +initSnowflakes(); +toggleSnowflakes(); - const screenWidth = window.innerWidth; // get the screen width to detect mobile devices - if (randomSnowflakes && (screenWidth > 768 || randomSnowflakesMobile)) { // add random snowflakes only on larger screens, unless enabled for mobile devices - addRandomSnowflakes(snowflakeCount); - } -}); \ No newline at end of file +const screenWidth = window.innerWidth; // get the screen width to detect mobile devices +if (randomSnowflakes && (screenWidth > 768 || randomSnowflakesMobile)) { // add random snowflakes only on larger screens, unless enabled for mobile devices + addRandomSnowflakes(snowflakeCount); +} diff --git a/seasonals/snowstorm.js b/seasonals/snowstorm.js index 2b0925e..5ca4aa3 100644 --- a/seasonals/snowstorm.js +++ b/seasonals/snowstorm.js @@ -98,7 +98,6 @@ function animateSnowflake(snowflake) { } // initialize snowstorm after the DOM is loaded -document.addEventListener('DOMContentLoaded', () => { - if (!snowstorm) return; // exit if snowstorm is disabled - createSnowstorm(); -}); +if (!snowstorm) return; // exit if snowstorm is disabled +createSnowstorm(); +