diff options
Diffstat (limited to 'web')
| -rw-r--r-- | web/client.html | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/web/client.html b/web/client.html index ba57839..3cddb29 100644 --- a/web/client.html +++ b/web/client.html @@ -76,6 +76,12 @@ let playing = {}; let votes = new Map(); + function formatSong(song) { + if (song.artist) + return song.artist + ' - ' + song.title + return song.title + } + function renderPlaylist() { playlist = document.getElementById("playlist"); playlist.innerHTML = ""; @@ -131,7 +137,7 @@ listItem.appendChild(upvoteBtn); listItem.appendChild(downvoteBtn); - const itemValue = document.createTextNode(song.artist + " - " + song.title); + const itemValue = document.createTextNode(formatSong(song)); listItem.appendChild(itemValue); playlist.appendChild(listItem); } @@ -163,7 +169,7 @@ renderPlaylist(); } - const songLabel = document.createTextNode(currentSong.artist + " - " + currentSong.title); + const songLabel = document.createTextNode(formatSong(currentSong)); playing = document.getElementById("playing"); playing.innerHTML = ""; @@ -234,7 +240,7 @@ listItem.classList.add("searchResult") - let searchResultLabel = document.createTextNode(song.artist + " - " + song.title); + let searchResultLabel = document.createTextNode(formatSong(song)); listItem.appendChild(searchResultLabel); searchResults.appendChild(listItem); |
