From 2a39b27b2f08ccaba418e303cbb3e6cac980875e Mon Sep 17 00:00:00 2001 From: kaotisk Date: Tue, 15 Oct 2024 06:10:04 +0300 Subject: Don't duplicate shows in every iteration --- client/js/radio_emulator.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/js/radio_emulator.js b/client/js/radio_emulator.js index 2388196..592426b 100644 --- a/client/js/radio_emulator.js +++ b/client/js/radio_emulator.js @@ -267,9 +267,13 @@ function syncOnDOMfromListCallback(now, hash_of_list, json) } function appendPreviouslyPlayedShows(listItem){ - var tmp = document.createElement('pre'); - tmp.innerText = JSON.stringify(listItem, null, 2); - placeholders.previouslyPlayed.append(tmp); + if ( document.querySelector(`#s-${listItem.hash}`) === null ) + { + var tmp = document.createElement('pre'); + tmp.id = `s-${listItem.hash}`; + tmp.innerText = JSON.stringify(listItem, null, 2); + placeholders.previouslyPlayed.append(tmp); + } } function listCallback(json, params) -- cgit v1.2.3