From a3ae8cd8028820bd2337dc8531602b0512ad09c9 Mon Sep 17 00:00:00 2001 From: SuperBFG7 Date: Sun, 3 Jun 2018 11:57:13 +0200 Subject: [PATCH] fix filtering with pagination --- htdocs/js/mpd.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index 913c0d9..1c2ac68 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -68,7 +68,7 @@ var app = $.sammy(function() { pagination = parseInt(this.params['splat'][0]); current_app = 'browse'; $('#breadcrump').removeClass('hide').empty().append("
  • root
  • "); - $('#filter').removeClass('hide'); + add_filter(); $('#salamisandwich').removeClass('hide').find("tr:gt(0)").remove(); $('#dirble_panel').addClass('hide'); socket.send('MPD_API_GET_BROWSE,'+pagination+','+(browsepath ? browsepath : "/")); @@ -185,8 +185,6 @@ $(document).ready(function(){ else if ($.cookie("notification") === "true") $('#btnnotify').addClass("active") - - add_filter(); }); function webSocketConnect() { @@ -314,7 +312,7 @@ function webSocketConnect() { case 'directory': var clazz = 'dir'; if (filter !== "") { - var first = obj.data[item].dir[0]; + var first = basename(obj.data[item].dir)[0]; if (filter === "num" && isNaN(first)) { clazz += ' hide'; } else if (filter >= "A" && filter <= "Z" && first.toUpperCase() !== filter) { @@ -1107,6 +1105,7 @@ function set_filter (c) { } function add_filter () { + $('#filter').empty(); $('#filter').append(' All'); $('#filter').append(' #'); @@ -1116,4 +1115,6 @@ function add_filter () { } $('#filter').append(' '); + $('#f' + filter).addClass('active'); + $('#filter').removeClass('hide'); } -- 2.20.1