From e61e581a2b66b0444db01d884465ea913929e343 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Tue, 31 Oct 2023 17:04:34 +0100 Subject: Updated 27 files, added 12 files and deleted 3 files (automated) --- app/ui/listing.php | 56 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 19 deletions(-) (limited to 'app/ui/listing.php') diff --git a/app/ui/listing.php b/app/ui/listing.php index d32525b..510fa58 100644 --- a/app/ui/listing.php +++ b/app/ui/listing.php @@ -87,15 +87,30 @@ if (!$presetList) { + +

- +

Favorites

-

+

+ +

Click on the heart icon near a song to add it to this list.
@@ -153,7 +168,7 @@ if (!$presetList) {

Add music to your library

Browse millions of songs and collect your favorites here.

-
Browse Mist
+
Browse Mist
@@ -183,29 +198,16 @@ if (!$presetList) { } - let items = Array.from(document.getElementsByClassName("track")).map(i => { return { title: i.getAttribute("data-item-track"), artist: i.getAttribute("data-item-artist"), id: i.id } }); - - const fuse = new Fuse(items, { - keys: [ - { - name: 'title', - weight: 1 - }, - { - name: 'artist', - weight: .5 - } - ] - }); + let items = Array.from(document.getElementsByClassName("track")).map(i => { return { title: i.getAttribute("data-item-track").toLowerCase().replace(/[^a-z\d ]/mg, " ").replace(/ +/mg, " "), artist: i.getAttribute("data-item-artist").toLowerCase().replace(/[^a-z\d ]/mg, " ").replace(/ +/mg, " "), id: i.id } }); function updateFilter() { - let query = document.getElementById("filter").value.trim(); + let query = document.getElementById("filter").value.trim().toLowerCase().replace(/[^a-z\d ]/mg, " ").replace(/ +/mg, " "); if (query !== "") { document.getElementById("search-results").style.display = "flex"; document.getElementById("main-list").style.display = "none"; - let results = items.filter(i => i.title.toLowerCase().replace(/[^a-z\d ]/mg, " ").replace(/ +/mg, " ").includes(query.toLowerCase().replace(/[^a-z\d ]/mg, " ").replace(/ +/mg, " ")) || i.artist.toLowerCase().replace(/[^a-z\d ]/mg, " ").replace(/ +/mg, " ").includes(query.toLowerCase().replace(/[^a-z\d ]/mg, " ").replace(/ +/mg, " "))); + let results = items.filter(i => i.title.includes(query) || i.artist.includes(query)).slice(0, 50); document.getElementById("search-results").innerHTML = ""; for (let result of results) { @@ -216,8 +218,24 @@ if (!$presetList) { document.getElementById("main-list").style.display = "flex"; } } + + function changeView() { + location.href = "favorites.php?u=" + document.getElementById("favorites-user-select").value; + } + +

\ No newline at end of file -- cgit