diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index 5174de7a..777242f9 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -708,6 +708,13 @@ Callbacks = { }, setPosition: function(position) { + // Wait until any pending movement is finished + if(MOVING) { + setTimeout(function() { + Callbacks.move(position); + }, 100); + return; + } $("#queue li").each(function() { $(this).removeClass("queue_active"); }); diff --git a/www/assets/js/data.js b/www/assets/js/data.js index 4043086e..3b5070c9 100644 --- a/www/assets/js/data.js +++ b/www/assets/js/data.js @@ -40,6 +40,7 @@ if($("#ytapiplayer").length > 0) { var VHEIGHT = ""+parseInt(parseInt(VWIDTH) * 9 / 16); } var POSITION = -1; +var MOVING = false; var REBUILDING = false; var socket = { emit: function() { diff --git a/www/assets/js/util.js b/www/assets/js/util.js index b6131162..defcccc7 100644 --- a/www/assets/js/util.js +++ b/www/assets/js/util.js @@ -952,6 +952,7 @@ function playlistMove(from, to) { if(from >= q.children().length) return false; + MOVING = true; var old = $(q.children()[from]); old.hide("blind", function() { old.detach(); @@ -960,6 +961,7 @@ function playlistMove(from, to) { else old.insertBefore(q.children()[to]); old.show("blind"); + MOVING = false; }); }