From ff8d9c80e6b5e65a80505f0b830f48cc20cae657 Mon Sep 17 00:00:00 2001 From: Emil Miler Date: Mon, 30 Dec 2024 13:59:42 +0100 Subject: [PATCH] Filter artist names as well --- static/js/filter.js | 5 ++++- templates/index.html | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/static/js/filter.js b/static/js/filter.js index 4c5f7a5..933cced 100644 --- a/static/js/filter.js +++ b/static/js/filter.js @@ -23,7 +23,10 @@ function filterSongs() { const searchTerm = sanitizeString(search.value); const songs = Array.from(songList.children); songs.forEach(song => { - const matching = song.dataset.title.includes(searchTerm) && (!selectedCategory || song.dataset.category === selectedCategory); + const matching = ( + (song.dataset.title.includes(searchTerm) || (song.dataset.artist && song.dataset.artist.includes(searchTerm))) && + (!selectedCategory || song.dataset.category === selectedCategory) + ); song.classList.toggle("hidden", !matching); }); } diff --git a/templates/index.html b/templates/index.html index b9ef728..fe81a53 100644 --- a/templates/index.html +++ b/templates/index.html @@ -21,7 +21,13 @@
{% for song in section.pages %} -
+
{{ song.title }}
{% if song.taxonomies["artist"] %}