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-status").textContent = "Radio is offline.";
|
||||||
$("radio-song").textContent =
|
$("radio-song").textContent =
|
||||||
$("radio-listeners").textContent =
|
$("radio-listeners").textContent =
|
||||||
$("radio-listener-peak").textContent = "n/a";
|
$("radio-listener-peak").textContent = "";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,20 +21,15 @@ function updateLastPlayedSong() {
|
|||||||
fetch('/lastsong')
|
fetch('/lastsong')
|
||||||
.then(r => r.json())
|
.then(r => r.json())
|
||||||
.then(last_played => {
|
.then(last_played => {
|
||||||
let cur_time = $('last-played').firstChild.lastChild.firstChild.innerText;
|
if (last_played.time == $('last-played').firstChild.lastChild.firstChild.innerText)
|
||||||
|
|
||||||
if (last_played.time == cur_time)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$('last-played').firstChild.firstChild.remove();
|
$('last-played').firstChild.firstChild.remove();
|
||||||
|
|
||||||
let row = $('last-played').insertRow();
|
let row = $('last-played').insertRow();
|
||||||
let start_time = row.insertCell();
|
row.insertCell().appendChild(document.createTextNode(last_played.time));
|
||||||
start_time.appendChild(document.createTextNode(last_played.time));
|
row.insertCell().appendChild(document.createTextNode(last_played.listeners == 0 ? "" : last_played.listeners));
|
||||||
let listeners_cell = row.insertCell();
|
row.insertCell().appendChild(document.createTextNode(last_played.song));
|
||||||
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));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user