';
html += '';
html += '';
html += '';
html += '';
- if (rating === 5) {
+ if (starred) {
html += '';
} else {
html += '';
diff --git a/js/libs/player.js b/js/libs/player.js
index ad46cfd..88ccc2b 100644
--- a/js/libs/player.js
+++ b/js/libs/player.js
@@ -167,6 +167,23 @@ function rateSong(songid, rating) {
}
});
}
+function starItem(itemid, starred) {
+ var url;
+ if (starred) {
+ url = baseURL + '/star.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + itemid;
+ } else {
+ url = baseURL + '/unstar.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + itemid;
+ }
+ $.ajax({
+ url: url,
+ method: 'GET',
+ dataType: 'jsonp',
+ timeout: 10000,
+ success: function () {
+ updateMessage('Favorite Updated!');
+ }
+ });
+}
function playPauseSong() {
var el = '#PlayTrack';
if ($(el).hasClass('playing')) {
diff --git a/js/ui-ready.js b/js/ui-ready.js
index b1a6e90..c91884d 100755
--- a/js/ui-ready.js
+++ b/js/ui-ready.js
@@ -174,14 +174,16 @@
});
$('tr.album a.rate').live('click', function (event) {
var itemid = $(this).parent().parent().attr('childid');
- rateSong(itemid, 5);
+ //rateSong(itemid, 5);
+ starItem(itemid, true);
$(this).removeClass('rate');
$(this).addClass('favorite');
return false;
});
$('tr.album a.favorite').live('click', function (event) {
var itemid = $(this).parent().parent().attr('childid');
- rateSong(itemid, 0);
+ //rateSong(itemid, 0);
+ starItem(itemid, false);
$(this).removeClass('favorite');
$(this).addClass('rate');
return false;
@@ -273,14 +275,16 @@
});
$('table.songlist tr.song a.rate').live('click', function (event) {
var songid = $(this).parent().parent().attr('childid');
- rateSong(songid, 5);
+ //rateSong(songid, 5);
+ starItem(songid, true);
$(this).removeClass('rate');
$(this).addClass('favorite');
return false;
});
$('table.songlist tr.song a.favorite').live('click', function (event) {
var songid = $(this).parent().parent().attr('childid');
- rateSong(songid, 0);
+ //rateSong(songid, 0);
+ starItem(songid, false);
$(this).removeClass('favorite');
$(this).addClass('rate');
return false;
@@ -539,14 +543,16 @@
});
$('#songdetails a.rate').live('click', function (event) {
var itemid = $('#songdetails_song').attr('childid');
- rateSong(itemid, 5);
+ //rateSong(itemid, 5);
+ starItem(itemid, true);
$(this).removeClass('rate');
$(this).addClass('favorite');
return false;
});
$('#songdetails a.favorite').live('click', function (event) {
var itemid = $('#songdetails_song').attr('childid');
- rateSong(itemid, 0);
+ //rateSong(itemid, 0);
+ starItem(itemid, false);
$(this).removeClass('favorite');
$(this).addClass('rate');
return false;
@@ -713,5 +719,5 @@
}
}).disableSelection();
-}); // End document.ready
+}); // End document.ready
diff --git a/manifest.json b/manifest.json
index 872fd0c..3f9bef2 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,7 +2,7 @@
"manifest_version": 1,
"name": "MiniSub",
"description": "MiniSub - HTML5 Mini Player for Subsonic",
- "version": "2.0.9",
+ "version": "2.1",
"app": {
"launch": {
"local_path": "index.html"
|