diff --git a/seasonals/autumn.js b/seasonals/autumn.js index 46f5aa2..2482cd7 100644 --- a/seasonals/autumn.js +++ b/seasonals/autumn.js @@ -135,12 +135,16 @@ function initLeaves() { } } -// initialize leaves and add random leaves after the DOM is loaded -if (!leaves) return; // exit if leaves are disabled -initLeaves(); -toggleAutumn(); +// initialize leaves and add random leaves +function initializeLeaves() { + 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); + 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); + } } + +initializeLeaves(); \ No newline at end of file diff --git a/seasonals/christmas.js b/seasonals/christmas.js index fc0d43b..732ebc6 100644 --- a/seasonals/christmas.js +++ b/seasonals/christmas.js @@ -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(); \ No newline at end of file diff --git a/seasonals/fireworks.js b/seasonals/fireworks.js index 5dd8688..84ad087 100644 --- a/seasonals/fireworks.js +++ b/seasonals/fireworks.js @@ -151,7 +151,11 @@ function startFireworks() { }, intervalOfFireworks); // Interval between fireworks } -// Initialize fireworks and add random fireworks after the DOM is loaded -if (!fireworks) return; // exit if fireworks are disabled -startFireworks(); -toggleFirework(); +// Initialize fireworks and add random fireworks +function initializeFireworks() { + if (!fireworks) return; // exit if fireworks are disabled + startFireworks(); + toggleFirework(); +} + +initializeFireworks(); \ No newline at end of file diff --git a/seasonals/halloween.js b/seasonals/halloween.js index 4d6f1ec..af0fad2 100644 --- a/seasonals/halloween.js +++ b/seasonals/halloween.js @@ -122,12 +122,16 @@ function createHalloween() { } } -// initialize halloween after the DOM is loaded -if (!halloween) return; // exit if halloween is disabled -createHalloween(); -toggleHalloween(); +// initialize halloween +function initializeHalloween() { + 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); + } } + +initializeHalloween(); \ No newline at end of file diff --git a/seasonals/hearts.js b/seasonals/hearts.js index ac3c0cc..0ea7f9d 100644 --- a/seasonals/hearts.js +++ b/seasonals/hearts.js @@ -111,12 +111,16 @@ function createHearts() { } -// initialize hearts after the DOM is loaded -if (!hearts) return; // exit if hearts is disabled -createHearts(); -toggleHearts(); +// initialize hearts +function initializeHearts() { + 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); + } } + +initializeHearts(); \ No newline at end of file diff --git a/seasonals/seasonals.js b/seasonals/seasonals.js index ccc99d9..cc9373b 100644 --- a/seasonals/seasonals.js +++ b/seasonals/seasonals.js @@ -1,7 +1,7 @@ // theme-configs.js const automateThemeSelection = false; // Set to false to disable automatic theme selection based on the current month -const defaultTheme = 'snowflakes'; // The theme to use if automatic theme selection is disabled +const defaultTheme = 'snowfall'; // The theme to use if automatic theme selection is disabled // theme configurations const themeConfigs = { diff --git a/seasonals/snowfall.js b/seasonals/snowfall.js index 23b09bd..f59cb81 100644 --- a/seasonals/snowfall.js +++ b/seasonals/snowfall.js @@ -99,6 +99,12 @@ function animateSnowflake(snowflake) { fall(); } -// initialize snowfall after the DOM is loaded -if (!snowfall) return; // exit if snowfall is disabled -createSnowflakes(); +// initialize snowfall +function initializeSnowfall() { + if (!snowfall) { + return; // exit if snowfall is disabled + } + createSnowflakes(); +} + +initializeSnowfall(); \ No newline at end of file diff --git a/seasonals/snowflakes.js b/seasonals/snowflakes.js index dbb4f9c..1ba0519 100644 --- a/seasonals/snowflakes.js +++ b/seasonals/snowflakes.js @@ -117,12 +117,16 @@ function initSnowflakes() { } } -// initialize snowflakes and add random snowflakes after the DOM is loaded -if (!snowflakes) return; // exit if snowflakes are disabled -initSnowflakes(); -toggleSnowflakes(); +// initialize snowflakes and add random snowflakes +function initializeSnowflakes() { + 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); + 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); + } } + +initializeSnowflakes(); \ No newline at end of file diff --git a/seasonals/snowstorm.js b/seasonals/snowstorm.js index 5ca4aa3..c33e89a 100644 --- a/seasonals/snowstorm.js +++ b/seasonals/snowstorm.js @@ -97,7 +97,10 @@ function animateSnowflake(snowflake) { fall(); } -// initialize snowstorm after the DOM is loaded -if (!snowstorm) return; // exit if snowstorm is disabled -createSnowstorm(); +// initialize snowstorm +function initializeSnowstorm() { + if (!snowstorm) return; // exit if snowstorm is disabled + createSnowstorm(); +} +initializeSnowstorm(); \ No newline at end of file