From: 2weiEmu Date: Sun, 15 Mar 2026 22:10:29 +0000 (+0100) Subject: made some fixes to the searching to make it way better X-Git-Url: https://git.saalbach.dev/?a=commitdiff_plain;h=5a8c0ee05c4ffd5f61cf057c4305feba41416af4;p=binbsis50-sm.git made some fixes to the searching to make it way better --- diff --git a/public/js/index.js b/public/js/index.js index 03f9b49..3fc8d4f 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -56,7 +56,7 @@ function newSongDisplayWithEdit(song) { let wrap = document.createElement("div") wrap.id = "key=" + song.Key let info = document.createElement("p") - info.innerText = "(" + song.Key + ") " + song.DisplayTrackName + " by " + song.DisplayArtistNames + info.innerText = "(" + song.Key + ") " + song.DisplayTrackName + " by " + song.DisplayArtistNames.replace("~", ", ") let but = document.createElement("button") but.innerText = "Edit" @@ -81,7 +81,8 @@ function filterSongByAllAttrs(filter, song) { function filterAllSongs(event) { console.log("Firing input trigger") - let filterBy = allSongFilterList.value + let filterBy = allSongFilterList.value.toLowerCase() + let filters = filterBy.split(" ") console.log("Filtering by:" + filterBy) if (AllSongs == null) { @@ -89,10 +90,21 @@ function filterAllSongs(event) { return } + if (filterBy == "") { + get_updated_status() + return + } + dbSongList.innerHTML = "" + let addSong = true for (let song of AllSongs) { - if (filterSongByAllAttrs(filterBy, song)) { + addSong = true + for (let filter of filters) { + addSong = addSong && filterSongByAllAttrs(filter, song) + } + + if (addSong) { let li = document.createElement("li") li.appendChild(newSongDisplayWithEdit(song)) dbSongList.appendChild(li) diff --git a/songmanager b/songmanager index 1385a4b..68ffd5b 100755 Binary files a/songmanager and b/songmanager differ diff --git a/todo.txt b/todo.txt new file mode 100644 index 0000000..010fde5 --- /dev/null +++ b/todo.txt @@ -0,0 +1,9 @@ +better filtering + +separate things to filter on + +case insensitive + +styling + +reload rooms needs to actually work