aboutsummaryrefslogtreecommitdiff
path: root/web/client.html
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2022-07-26 22:23:37 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2022-07-26 22:23:37 +0200
commit33fd4442dd8297d02d284e82cf09bbfec01c705a (patch)
treebe15f36161859c24971f62b3f89c4effe9c1e349 /web/client.html
parent7e15ad1d8af4ee27f6c1d31e7b1608e2d751c402 (diff)
downloadWRMS-33fd4442dd8297d02d284e82cf09bbfec01c705a.tar.gz
WRMS-33fd4442dd8297d02d284e82cf09bbfec01c705a.zip
add youtube backend
Diffstat (limited to 'web/client.html')
-rw-r--r--web/client.html12
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);