1
0

Now if a list is emty and a table doesn't contains a tbody element it will be correctly created and a song will be added.

This commit is contained in:
Alexander Andreev 2023-06-12 21:50:10 +04:00
parent f05fe5d888
commit 12a7c7732b
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -21,11 +21,10 @@ function updateLastPlayedSong() {
fetch('/lastsong')
.then(r => r.json())
.then(last_played => {
if (last_played.time == $('last-played').firstChild.lastChild.firstChild.innerText)
return;
if ($('last-played').firstChild === null)
$('last-played').appendChild(document.createElement("tbody"))
else if (last_played.time == $('last-played').firstChild.lastChild.firstChild.innerText)
return;
if ($('last-played').firstChild.children.length == 10)
$('last-played').firstChild.firstChild.remove();