From a0698753c504d5013785152fb6787b77ee263e2a Mon Sep 17 00:00:00 2001 From: erik Date: Thu, 26 Feb 2026 09:19:13 +0000 Subject: [PATCH] Fix highlightRareFinder to use element pool instead of DOM query Co-Authored-By: Claude Opus 4.6 --- static/script.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/static/script.js b/static/script.js index 02fac38f..419881d1 100644 --- a/static/script.js +++ b/static/script.js @@ -2150,18 +2150,16 @@ function createFireworks() { } function highlightRareFinder(characterName) { - // Find the player in the list - const playerItems = document.querySelectorAll('#playerList li'); - playerItems.forEach(item => { - const nameSpan = item.querySelector('.player-name'); - if (nameSpan && nameSpan.textContent.includes(characterName)) { - item.classList.add('rare-finder-glow'); - // Remove glow after duration - setTimeout(() => { - item.classList.remove('rare-finder-glow'); - }, GLOW_DURATION_MS); + // Use element pool for O(1) lookup instead of querySelectorAll + for (const item of elementPools.activeListItems) { + if (item.playerData && item.playerData.character_name === characterName) { + item.classList.add('rare-finder-glow'); + setTimeout(() => { + item.classList.remove('rare-finder-glow'); + }, GLOW_DURATION_MS); + break; + } } - }); } // Update total rares display to trigger fireworks on increase