diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index 23dc165..319805f 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -72,7 +72,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 : "/")); @@ -200,8 +200,6 @@ $(document).ready(function(){ if ($.cookie("notification") === "true") $('#btnnotify').addClass("active") - add_filter(); - document.getElementById('player').addEventListener('stalled', function() { if ( !document.getElementById('player').paused ) { this.pause(); @@ -403,7 +401,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) { @@ -1264,6 +1262,7 @@ function set_filter (c) { } function add_filter () { + $('#filter').empty(); $('#filter').append(' All'); $('#filter').append(' #'); @@ -1273,4 +1272,6 @@ function add_filter () { } $('#filter').append(' '); + $('#f' + filter).addClass('active'); + $('#filter').removeClass('hide'); }