From 152defeaaaeb0ec001549f43f6ba3f247be6f106 Mon Sep 17 00:00:00 2001 From: SuperBFG7 Date: Sat, 18 Mar 2017 13:32:17 +0100 Subject: [PATCH] add a button to love tracks on last.fm using mpdas --- 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 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)); -- 2.20.1