From 4e2f3006432ace2b0568eb57d0dc38e630382b8c Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Mon, 17 Aug 2015 17:01:47 -0400 Subject: [PATCH] Add "Add all" button in the Browse section It adds all items in the directory. It's equivalent to clicking on "+" on that same directory we decided to browse. --- htdocs/index.html | 5 +++++ htdocs/js/mpd.js | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/htdocs/index.html b/htdocs/index.html index 3ba6a7e..1e026dc 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -97,6 +97,11 @@ +
+ +
+ + diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index 49a4656..f4dece3 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -41,6 +41,7 @@ var app = $.sammy(function() { function prepare() { $('#nav_links > li').removeClass('active'); $('.page-btn').addClass('hide'); + $('#add-all-songs').hide(); pagination = 0; browsepath = ''; } @@ -59,6 +60,15 @@ var app = $.sammy(function() { $('#breadcrump').removeClass('hide').empty().append("
  • root
  • "); $('#salamisandwich').find("tr:gt(0)").remove(); socket.send('MPD_API_GET_BROWSE,'+pagination+','+(browsepath ? browsepath : "/")); + // Don't add all songs from root + if (browsepath) { + var add_all_songs = $('#add-all-songs'); + add_all_songs.off(); // remove previous binds + add_all_songs.on('click', function() { + socket.send('MPD_API_ADD_TRACK,'+browsepath); + }); + add_all_songs.show(); + } $('#panel-heading').text("Browse database: "+browsepath); var path_array = browsepath.split('/'); -- 2.20.1