From 93d5686b77e8222e831da19e21099d162095cb67 Mon Sep 17 00:00:00 2001 From: CodeDevMLH <145071728+CodeDevMLH@users.noreply.github.com> Date: Sat, 28 Feb 2026 01:21:33 +0100 Subject: [PATCH] Refactor resurrection.js to remove random symbol functionality and adjust symbol count initialization for mobile responsiveness --- Jellyfin.Plugin.Seasonals/Web/resurrection.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Jellyfin.Plugin.Seasonals/Web/resurrection.js b/Jellyfin.Plugin.Seasonals/Web/resurrection.js index 11443bd..bff4c61 100644 --- a/Jellyfin.Plugin.Seasonals/Web/resurrection.js +++ b/Jellyfin.Plugin.Seasonals/Web/resurrection.js @@ -1,10 +1,9 @@ const config = window.SeasonalsPluginConfig?.Resurrection || {}; const enableResurrection = config.EnableResurrection !== undefined ? config.EnableResurrection : true; // enable/disable resurrection -const enableRandomSymbols = config.EnableRandomSymbols !== undefined ? config.EnableRandomSymbols : true; // enable random symbols -const enableRandomSymbolsMobile = config.EnableRandomSymbolsMobile !== undefined ? config.EnableRandomSymbolsMobile : false; // enable random symbols on mobile const enableDifferentDuration = config.EnableDifferentDuration !== undefined ? config.EnableDifferentDuration : true; // enable different durations const symbolCount = config.SymbolCount !== undefined ? config.SymbolCount : 12; // count of symbols +const symbolCountMobile = config.SymbolCountMobile !== undefined ? config.SymbolCountMobile : 5; // count of symbols on mobile let animationEnabled = true; let statusLogged = false; @@ -78,10 +77,7 @@ function createSymbol(imageSrc, leftPercent, delaySeconds) { function addSymbols(count) { const container = document.querySelector('.resurrection-container'); - if (!container || !enableRandomSymbols) return; - - const isDesktop = window.innerWidth > 768; - if (!isDesktop && !enableRandomSymbolsMobile) return; + if (!container) return; for (let i = 0; i < count; i++) { const imageSrc = images[Math.floor(Math.random() * images.length)]; @@ -91,7 +87,7 @@ function addSymbols(count) { } } -function initResurrection() { +function initResurrection(count) { let container = document.querySelector('.resurrection-container'); if (!container) { container = document.createElement('div'); @@ -107,13 +103,17 @@ function initResurrection() { container.appendChild(createSymbol(imageSrc, left, delay)); }); - const extraCount = Math.max(symbolCount - images.length, 0); + const extraCount = Math.max(count - images.length, 0); addSymbols(extraCount); } function initializeResurrection() { if (!enableResurrection) return; - initResurrection(); + + const isMobile = window.matchMedia("only screen and (max-width: 768px)").matches; + const count = !isMobile ? symbolCount : symbolCountMobile; + + initResurrection(count); toggleResurrection(); }