diff --git a/Jellyfin.Plugin.Seasonals/Web/snowflakes.js b/Jellyfin.Plugin.Seasonals/Web/snowflakes.js index 9521e64..14fc473 100644 --- a/Jellyfin.Plugin.Seasonals/Web/snowflakes.js +++ b/Jellyfin.Plugin.Seasonals/Web/snowflakes.js @@ -7,6 +7,8 @@ const enableColoredSnowflakes = config.EnableColoredSnowflakes !== undefined ? c const enableDiffrentDuration = config.EnableDifferentDuration !== undefined ? config.EnableDifferentDuration : true; // enable different animation duration const snowflakeCount = config.SnowflakeCount || 25; // count of random extra snowflakes +const snowflakeSymbols = ['❅', '❆']; // some snowflake symbols +const snowflakeSymbolsMobile = ['❅', '❆', '❄']; // some snowflake symbols mobile version let msgPrinted = false; // flag to prevent multiple console messages @@ -19,7 +21,7 @@ function toggleSnowflakes() { const trailerPlayer = document.querySelector('.youtubePlayerContainer'); const isDashboard = document.body.classList.contains('dashboardDocument'); const hasUserMenu = document.querySelector('#app-user-menu'); - + // hide snowflakes if video/trailer player is active or dashboard is visible if (videoPlayer || trailerPlayer || isDashboard || hasUserMenu) { snowflakeContainer.style.display = 'none'; // hide snowflakes @@ -38,12 +40,10 @@ function toggleSnowflakes() { // observe changes in the DOM const observer = new MutationObserver(toggleSnowflakes); - -// start observation observer.observe(document.body, { - childList: true, // observe adding/removing of child elements - subtree: true, // observe all levels of the DOM tree - attributes: true // observe changes to attributes (e.g. class changes) + childList: true, + subtree: true, + attributes: true }); function addRandomSnowflakes(count) { @@ -52,9 +52,6 @@ function addRandomSnowflakes(count) { console.log('Adding random snowflakes'); - const snowflakeSymbols = ['❅', '❆']; // some snowflake symbols - const snowflakeSymbolsMobile = ['❅', '❆', '❄']; // some snowflake symbols mobile version - for (let i = 0; i < count; i++) { // create a new snowflake element const snowflake = document.createElement('div'); @@ -70,7 +67,7 @@ function addRandomSnowflakes(count) { // set random horizontal position, animation delay and size(uncomment lines to enable) const randomLeft = Math.random() * 100; // position (0% to 100%) const randomAnimationDelay = Math.random() * 8; // delay (0s to 8s) - const randomAnimationDelay2 = Math.random() * 5; // delay (0s to 5s) + const randomAnimationDelay2 = -(Math.random() * 5); // delay (-5s to 0s) // apply styles snowflake.style.left = `${randomLeft}%`;