Reduced main.js a little.
This commit is contained in:
parent
b035476fb7
commit
066208def4
@ -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));
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user