diff --git a/internal/handlers/web/assets/js/main.js b/internal/handlers/web/assets/js/main.js index 52b2805..199ccb5 100644 --- a/internal/handlers/web/assets/js/main.js +++ b/internal/handlers/web/assets/js/main.js @@ -13,7 +13,7 @@ function updateRadioStatus() { $("radio-status").textContent = "Radio is offline."; $("radio-song").textContent = $("radio-listeners").textContent = - $("radio-listener-peak").textContent = "n/a"; + $("radio-listener-peak").textContent = ""; }); } @@ -21,20 +21,15 @@ function updateLastPlayedSong() { fetch('/lastsong') .then(r => r.json()) .then(last_played => { - let cur_time = $('last-played').firstChild.lastChild.firstChild.innerText; - - if (last_played.time == cur_time) + if (last_played.time == $('last-played').firstChild.lastChild.firstChild.innerText) return; $('last-played').firstChild.firstChild.remove(); let row = $('last-played').insertRow(); - let start_time = row.insertCell(); - start_time.appendChild(document.createTextNode(last_played.time)); - let listeners_cell = row.insertCell(); - listeners_cell.appendChild(document.createTextNode(last_played.listeners == 0 ? "" : last_played.listeners)); - let song_cell = row.insertCell(); - song_cell.appendChild(document.createTextNode(last_played.song)); + row.insertCell().appendChild(document.createTextNode(last_played.time)); + row.insertCell().appendChild(document.createTextNode(last_played.listeners == 0 ? "" : last_played.listeners)); + row.insertCell().appendChild(document.createTextNode(last_played.song)); }); }