Filter artist names as well
All checks were successful
Build / build (push) Successful in 2m37s

This commit is contained in:
2024-12-30 13:59:42 +01:00
parent 842b66def0
commit ff8d9c80e6
2 changed files with 11 additions and 2 deletions

View File

@ -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);
});
}