]> git.example.dev Git - binbsis50-sm.git/commitdiff
made some fixes to the searching to make it way better
author2weiEmu <saalbach.robert@outlook.de>
Sun, 15 Mar 2026 22:10:29 +0000 (23:10 +0100)
committer2weiEmu <saalbach.robert@outlook.de>
Sun, 15 Mar 2026 22:10:29 +0000 (23:10 +0100)
public/js/index.js
songmanager
todo.txt [new file with mode: 0644]

index 03f9b49b72ae7d1d8b2066e82c9c9e31448e90bd..3fc8d4f61d076b35c7be3b80a18f61ba0d139a39 100644 (file)
@@ -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)
index 1385a4b133fc552304cdb65073af9f19629e0553..68ffd5bfbcbdc07e1b78cc88978b38c32a7712d1 100755 (executable)
Binary files a/songmanager and b/songmanager differ
diff --git a/todo.txt b/todo.txt
new file mode 100644 (file)
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