Fix highlightRareFinder to use element pool instead of DOM query
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
395b7fb7ec
commit
a0698753c5
1 changed files with 9 additions and 11 deletions
|
|
@ -2150,18 +2150,16 @@ function createFireworks() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function highlightRareFinder(characterName) {
|
function highlightRareFinder(characterName) {
|
||||||
// Find the player in the list
|
// Use element pool for O(1) lookup instead of querySelectorAll
|
||||||
const playerItems = document.querySelectorAll('#playerList li');
|
for (const item of elementPools.activeListItems) {
|
||||||
playerItems.forEach(item => {
|
if (item.playerData && item.playerData.character_name === characterName) {
|
||||||
const nameSpan = item.querySelector('.player-name');
|
item.classList.add('rare-finder-glow');
|
||||||
if (nameSpan && nameSpan.textContent.includes(characterName)) {
|
setTimeout(() => {
|
||||||
item.classList.add('rare-finder-glow');
|
item.classList.remove('rare-finder-glow');
|
||||||
// Remove glow after duration
|
}, GLOW_DURATION_MS);
|
||||||
setTimeout(() => {
|
break;
|
||||||
item.classList.remove('rare-finder-glow');
|
}
|
||||||
}, GLOW_DURATION_MS);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update total rares display to trigger fireworks on increase
|
// Update total rares display to trigger fireworks on increase
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue