From: SuperBFG7 Date: Sat, 18 Mar 2017 12:32:17 +0000 (+0100) Subject: add a button to love tracks on last.fm using mpdas X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=152defeaaaeb0ec001549f43f6ba3f247be6f106;p=ympd.git add a button to love tracks on last.fm using mpdas --- diff --git a/htdocs/index.html b/htdocs/index.html index ed77279..0ed3f94 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -55,6 +55,11 @@ +
+ +
diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index 6000b79..577b076 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -466,6 +466,8 @@ function webSocketConnect() { $('#album').text(""); $('#artist').text(""); + $('#btnlove').removeClass("active"); + $('#currenttrack').text(" " + obj.data.title); var notification = "

" + obj.data.title + "

"; @@ -598,6 +600,14 @@ function basename(path) { return path.split('/').reverse()[0]; } +function clickLove() { + socket.send("MPD_API_SEND_MESSAGE,mpdas," + ($('#btnlove').hasClass('active') ? "unlove" : "love")); + if ( $('#btnlove').hasClass('active') ) + $('#btnlove').removeClass("active"); + else + $('#btnlove').addClass("active"); +} + $('#btnrandom').on('click', function (e) { socket.send("MPD_API_TOGGLE_RANDOM," + ($(this).hasClass('active') ? 0 : 1));