From 68dc9efa4dcc824852b6254bc0caa9bb41142945 Mon Sep 17 00:00:00 2001 From: CodeDevMLH <145071728+CodeDevMLH@users.noreply.github.com> Date: Sat, 28 Feb 2026 00:52:27 +0100 Subject: [PATCH] Refactor oktoberfest.js to enhance configuration handling for symbol counts and durations --- Jellyfin.Plugin.Seasonals/Web/oktoberfest.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Jellyfin.Plugin.Seasonals/Web/oktoberfest.js b/Jellyfin.Plugin.Seasonals/Web/oktoberfest.js index f49acaf..abc34e3 100644 --- a/Jellyfin.Plugin.Seasonals/Web/oktoberfest.js +++ b/Jellyfin.Plugin.Seasonals/Web/oktoberfest.js @@ -1,5 +1,8 @@ const config = window.SeasonalsPluginConfig?.Oktoberfest || {}; const oktoberfest = config.EnableOktoberfest !== undefined ? config.EnableOktoberfest : true; // enable/disable oktoberfest +const symbolCount = config.SymbolCount !== undefined ? config.SymbolCount : 25; // count of symbols +const symbolCountMobile = config.SymbolCountMobile !== undefined ? config.SymbolCountMobile : 10; // count of symbols on mobile +const enableDifferentDuration = config.EnableDifferentDuration !== undefined ? config.EnableDifferentDuration : true; // enable different durations const oktoberfestSymbols = ['🥨', '🍺', '🍻', '🥨', '🥨']; @@ -38,8 +41,8 @@ observer.observe(document.body, { attributes: true }); -function createOktoberfest(container) { - for (let i = 0; i < 20; i++) { +function createOktoberfest(container, count) { + for (let i = 0; i < count; i++) { const symbol = document.createElement('div'); symbol.className = 'oktoberfest-symbol'; symbol.textContent = oktoberfestSymbols[Math.floor(Math.random() * oktoberfestSymbols.length)]; @@ -47,7 +50,9 @@ function createOktoberfest(container) { symbol.style.animationDelay = `${Math.random() * 10}s, ${Math.random() * 5}s`; const duration1 = Math.random() * 5 + 8; const duration2 = Math.random() * 3 + 3; - symbol.style.animationDuration = `${duration1}s, ${duration2}s`; + if (enableDifferentDuration) { + symbol.style.animationDuration = `${duration1}s, ${duration2}s`; + } container.appendChild(symbol); } @@ -61,6 +66,10 @@ function initializeOktoberfest() { container.setAttribute("aria-hidden", "true"); document.body.appendChild(container); } - createOktoberfest(container); + + const screenWidth = window.innerWidth; + const count = screenWidth > 768 ? symbolCount : symbolCountMobile; + + createOktoberfest(container, count); } initializeOktoberfest();