Changed formatting in main.js. Also innerText was replaced with textContent.
This commit is contained in:
parent
28c2cf21a0
commit
790b08e22c
@ -10,17 +10,15 @@ function updateRadioStatus() {
|
||||
}).catch(() => {
|
||||
$("radio-song").textContent = "";
|
||||
$("radio-listeners").textContent =
|
||||
$("radio-listener-peak").textContent = "0";
|
||||
});
|
||||
}
|
||||
$("radio-listener-peak").textContent = "0"; }); }
|
||||
|
||||
function updateLastPlayedSong() {
|
||||
fetch("/lastsong")
|
||||
.then(r => r.json())
|
||||
.then(last_played => {
|
||||
if ($("last-songs").firstChild === null)
|
||||
$("last-songs").appendChild(document.createElement("tbody"))
|
||||
else if (last_played.time == $("last-songs").firstChild.lastChild.firstChild.innerText)
|
||||
$("last-songs").appendChild(document.createElement("tbody"));
|
||||
else if (last_played.time == $("last-songs").firstChild.lastChild.firstChild.textContent)
|
||||
return;
|
||||
|
||||
if ($("last-songs").firstChild.children.length == 10)
|
||||
@ -29,9 +27,7 @@ function updateLastPlayedSong() {
|
||||
let row = $("last-songs").insertRow();
|
||||
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));
|
||||
});
|
||||
}
|
||||
row.insertCell().appendChild(document.createTextNode(last_played.song)); }); }
|
||||
|
||||
$("radio-update").addEventListener("click", () => {
|
||||
updateLastPlayedSong();
|
||||
@ -57,16 +53,14 @@ audio.addEventListener("timeupdate", e => {
|
||||
const h = Math.floor(ct / 3600);
|
||||
$("radio-elapsed").textContent = `${h}h ${m}m ${s}s`; });
|
||||
|
||||
$("player").style.display =
|
||||
$("player").firstChild.style.display = "flex";
|
||||
$("player").style.display = "flex";
|
||||
|
||||
$("radio-play").addEventListener("click", e => {
|
||||
if (audio.paused) {
|
||||
audio.src = audio_src;
|
||||
audio.play();
|
||||
} else {
|
||||
audio.pause();
|
||||
} else
|
||||
audio.src = "";
|
||||
}
|
||||
e.target.style.maskImage = e.target.style.webkitMaskImage = audio.paused ?
|
||||
"url(/assets/img/play.svg)" : "url(/assets/img/stop.svg)"; });
|
||||
|
Loading…
Reference in New Issue
Block a user