From 97dbc09daab5aaef229bca5c517e468550f3f1de Mon Sep 17 00:00:00 2001 From: CodeDevMLH <145071728+CodeDevMLH@users.noreply.github.com> Date: Tue, 24 Feb 2026 19:22:16 +0100 Subject: [PATCH] Refactor hearts.js: reorganize heartSymbols array and clean up observer initialization --- Jellyfin.Plugin.Seasonals/Web/hearts.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Jellyfin.Plugin.Seasonals/Web/hearts.js b/Jellyfin.Plugin.Seasonals/Web/hearts.js index bad2a52..d0331e3 100644 --- a/Jellyfin.Plugin.Seasonals/Web/hearts.js +++ b/Jellyfin.Plugin.Seasonals/Web/hearts.js @@ -6,6 +6,9 @@ const randomSymbolsMobile = config.EnableRandomSymbolsMobile !== undefined ? con const enableDiffrentDuration = config.EnableDifferentDuration !== undefined ? config.EnableDifferentDuration : true; // enable different animation duration for random symbols const heartsCount = config.SymbolCount || 25; // count of random extra symbols +// Array of hearts characters +const heartSymbols = ['❤️', '💕', '💞', '💓', '💗', '💖']; + let msgPrinted = false; // flag to prevent multiple console messages // function to check and control the hearts @@ -36,19 +39,13 @@ function toggleHearts() { // observe changes in the DOM const observer = new MutationObserver(toggleHearts); - -// 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 }); -// Array of hearts characters -const heartSymbols = ['❤️', '💕', '💞', '💓', '💗', '💖']; - - function addRandomSymbols(count) { const heartsContainer = document.querySelector('.hearts-container'); // get the hearts container if (!heartsContainer) return; // exit if hearts container is not found