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:
parent
f05fe5d888
commit
12a7c7732b
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user