diff --git a/web/assets/js/main.js b/web/assets/js/main.js index 9052b25..204a344 100644 --- a/web/assets/js/main.js +++ b/web/assets/js/main.js @@ -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();