diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-05-28 21:44:43 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-05-28 21:44:43 +0200 |
| commit | 2c0637e2a515d8f302e0f783171835608717c8ad (patch) | |
| tree | f87bdf23270a2e71a95f057968d83864e01e79db /web/client.html | |
| parent | d2327472f127b81f65c55cae61cbb89e30d1913e (diff) | |
| download | WRMS-2c0637e2a515d8f302e0f783171835608717c8ad.tar.gz WRMS-2c0637e2a515d8f302e0f783171835608717c8ad.zip | |
escape html for search results
Diffstat (limited to 'web/client.html')
| -rw-r--r-- | web/client.html | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/web/client.html b/web/client.html index 15d42ca..0f94c45 100644 --- a/web/client.html +++ b/web/client.html @@ -83,6 +83,12 @@ return song.title } + function newSourceLabel(song) { + const sourceLabel = document.createElement("SMALL"); + sourceLabel.appendChild(document.createTextNode(" (" + song.source + ")")); + return sourceLabel; + } + function renderPlaylist() { playlist = document.getElementById("playlist"); playlist.innerHTML = ""; @@ -139,9 +145,7 @@ listItem.appendChild(downvoteBtn); listItem.appendChild(document.createTextNode(song.weight + ' ' + formatSong(song))); - const sourceLabel = document.createElement("SMALL"); - sourceLabel.innerHTML = " (" + song.source + ")"; - listItem.appendChild(sourceLabel); + listItem.appendChild(newSourceLabel(song)); playlist.appendChild(listItem); } } @@ -295,7 +299,8 @@ }); listItem.classList.add("searchResult") - listItem.innerHTML = formatSong(song) + " <small>(" + song.source + ")</small>"; + listItem.appendChild(document.createTextNode(formatSong(song))); + listItem.appendChild(newSourceLabel(song)); searchResults.appendChild(listItem); } |
