From b74c8ad2a17bbec65fb0fc4ffe92270e3dc05270 Mon Sep 17 00:00:00 2001 From: CodeDevMLH <145071728+CodeDevMLH@users.noreply.github.com> Date: Tue, 24 Feb 2026 19:24:04 +0100 Subject: [PATCH] Refactor Santa feature: reorganize present images and Santa image constants for clarity --- Jellyfin.Plugin.Seasonals/Web/santa.js | 39 ++++++++++++-------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/Jellyfin.Plugin.Seasonals/Web/santa.js b/Jellyfin.Plugin.Seasonals/Web/santa.js index 972f561..3337096 100644 --- a/Jellyfin.Plugin.Seasonals/Web/santa.js +++ b/Jellyfin.Plugin.Seasonals/Web/santa.js @@ -11,6 +11,21 @@ const minSantaRestTime = config.MinSantaRestTime || 3; // minimum time santa res const maxPresentFallSpeed = config.MaxPresentFallSpeed || 5; // maximum speed of falling presents in seconds const minPresentFallSpeed = config.MinPresentFallSpeed || 2; // minimum speed of falling presents in seconds +// credits: flaticon.com +const presentImages = [ + '../Seasonals/Resources/santa_images/gift1.png', + '../Seasonals/Resources/santa_images/gift2.png', + '../Seasonals/Resources/santa_images/gift3.png', + '../Seasonals/Resources/santa_images/gift4.png', + '../Seasonals/Resources/santa_images/gift5.png', + '../Seasonals/Resources/santa_images/gift6.png', + '../Seasonals/Resources/santa_images/gift7.png', + '../Seasonals/Resources/santa_images/gift8.png', +]; + +// credits: https://www.animatedimages.org/img-animated-santa-claus-image-0420-85884.htm +const santaImage = '../Seasonals/Resources/santa_images/santa.gif'; + let msgPrinted = false; // flag to prevent multiple console messages let isMobile = false; // flag to detect mobile devices let canvas, ctx; // canvas and context for drawing snowflakes @@ -52,12 +67,10 @@ function toggleSnowfall() { // observe changes in the DOM const observer = new MutationObserver(toggleSnowfall); - -// 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 }); let resizeObserver; // Observer for resize events @@ -179,22 +192,6 @@ function updateSnowflakes() { }); } -// credits: flaticon.com -const presentImages = [ - '../Seasonals/Resources/santa_images/gift1.png', - '../Seasonals/Resources/santa_images/gift2.png', - '../Seasonals/Resources/santa_images/gift3.png', - '../Seasonals/Resources/santa_images/gift4.png', - '../Seasonals/Resources/santa_images/gift5.png', - '../Seasonals/Resources/santa_images/gift6.png', - '../Seasonals/Resources/santa_images/gift7.png', - '../Seasonals/Resources/santa_images/gift8.png', -]; - -// credits: https://www.animatedimages.org/img-animated-santa-claus-image-0420-85884.htm -const santaImage = '../Seasonals/Resources/santa_images/santa.gif'; - - function createSantaElement() { const santa = document.createElement('img'); santa.src = santaImage;