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