From 6673e6c20345a9816c9f88dd04bec1ae0a892272 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Sat, 27 Jul 2013 10:30:12 -0400 Subject: [PATCH] Fix #225 --- playlist.js | 8 +++++--- www/assets/js/callbacks.js | 9 ++++++++- www/assets/js/data.js | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/playlist.js b/playlist.js index e2f60902..917d23ae 100644 --- a/playlist.js +++ b/playlist.js @@ -340,10 +340,10 @@ Playlist.prototype.remove = function(uid, callback) { fn: function() { var item = pl.items.find(uid); if(pl.items.remove(uid)) { - if(item == pl.current) - pl._next(); if(callback) callback(); + if(item == pl.current) + pl._next(); } }, waiting: false @@ -386,7 +386,6 @@ Playlist.prototype.next = function() { return; var it = this.current; - this._next(); if(it.temp) { var pl = this; @@ -394,6 +393,9 @@ Playlist.prototype.next = function() { pl.on("remove")(it); }); } + else { + this._next(); + } return this.current; } diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index bbcfd7fd..78fbc9ea 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -717,9 +717,11 @@ Callbacks = { "delete": function(data) { queueAction({ fn: function () { + PL_WAIT_SCROLL = true; var li = $(".pluid-" + data.uid); li.hide("blind", function() { li.remove(); + PL_WAIT_SCROLL = false; }); return true; } @@ -749,7 +751,12 @@ Callbacks = { } li.addClass("queue_active"); - scrollQueue(); + var timer = setInterval(function () { + if(!PL_WAIT_SCROLL) { + scrollQueue(); + clearInterval(timer); + } + }, 100); return true; }, can_wait: true diff --git a/www/assets/js/data.js b/www/assets/js/data.js index 48554008..491239b1 100644 --- a/www/assets/js/data.js +++ b/www/assets/js/data.js @@ -67,6 +67,7 @@ var SESSION = readCookie("cytube_session"); var LEADTMR = false; var PL_FROM = ""; var PL_AFTER = ""; +var PL_WAIT_SCROLL = false; var FILTER_FROM = 0; var FILTER_TO = 0; var NO_STORAGE = typeof localStorage == "undefined" || localStorage === null;