Improve setCurrent

This commit is contained in:
calzoneman 2013-10-01 13:25:05 -05:00
parent 29a1f0b9d3
commit acb5136c15
1 changed files with 17 additions and 26 deletions

View File

@ -767,24 +767,24 @@ Callbacks = {
queueAction({ queueAction({
fn: function () { fn: function () {
var li = makeQueueEntry(data.item, true); var li = makeQueueEntry(data.item, true);
if (data.item.uid === PL_CURRENT)
li.addClass("queue_active");
li.hide(); li.hide();
var q = $("#queue"); var q = $("#queue");
li.attr("title", data.item.queueby li.attr("title", data.item.queueby
? ("Added by: " + data.item.queueby) ? ("Added by: " + data.item.queueby)
: "Added by: Unknown"); : "Added by: Unknown");
if(data.after === "prepend") { if (data.after === "prepend") {
li.prependTo(q); li.prependTo(q);
li.show("blind"); li.show("blind");
return true; return true;
} } else if (data.after === "append") {
else if(data.after === "append") {
li.appendTo(q); li.appendTo(q);
li.show("blind"); li.show("blind");
return true; return true;
} } else {
else {
var liafter = playlistFind(data.after); var liafter = playlistFind(data.after);
if(!liafter) { if (!liafter) {
return false; return false;
} }
li.insertAfter(liafter); li.insertAfter(liafter);
@ -873,27 +873,18 @@ Callbacks = {
}, },
setCurrent: function(uid) { setCurrent: function(uid) {
queueAction({
fn: function () {
PL_CURRENT = uid; PL_CURRENT = uid;
var qli = $("#queue li"); $("#queue li").removeClass("queue_active");
qli.removeClass("queue_active");
var li = $(".pluid-" + uid); var li = $(".pluid-" + uid);
if(li.length == 0) { if (li.length !== 0) {
return false;
}
li.addClass("queue_active"); li.addClass("queue_active");
var timer = setInterval(function () { var tmr = setInterval(function () {
if(!PL_WAIT_SCROLL) { if (!PL_WAIT_SCROLL) {
scrollQueue(); scrollQueue();
clearInterval(timer); clearInterval(tmr);
} }
}, 100); }, 100);
return true; }
},
can_wait: true
});
}, },
changeMedia: function(data) { changeMedia: function(data) {