diff --git a/www/js/callbacks.js b/www/js/callbacks.js index 97fdd1c4..d3ed54b4 100644 --- a/www/js/callbacks.js +++ b/www/js/callbacks.js @@ -724,7 +724,7 @@ Callbacks = { queue: function(data) { PL_ACTION_QUEUE.queue(function (plq) { - stopQueueSpinner(data.item.media.id); + stopQueueSpinner(data.item.media); var li = makeQueueEntry(data.item, true); if (data.item.uid === PL_CURRENT) li.addClass("queue_active"); diff --git a/www/js/ui.js b/www/js/ui.js index c014a8db..955d1fa7 100644 --- a/www/js/ui.js +++ b/www/js/ui.js @@ -420,7 +420,7 @@ function queue(pos, src) { delete data.link; socket.emit("queue", data); - startQueueSpinner(data.id); + startQueueSpinner(data); if (emitQueue.length > 0) { notification.textContent = "Waiting to queue " + emitQueue[0].link; } else { diff --git a/www/js/util.js b/www/js/util.js index dcfe3d9b..0dbe5987 100644 --- a/www/js/util.js +++ b/www/js/util.js @@ -3041,11 +3041,16 @@ function showChannelSettings() { // There is a point where this file needed to stop and we have clearly passed // it but let's keep going and see what happens -function startQueueSpinner(id) { +function startQueueSpinner(data) { if ($("#queueprogress").length > 0) { return; } + var id = data.id; + if (data.type === "yp") { + id = "$any"; + } + var progress = $("
").addClass("progress").attr("id", "queueprogress") .data("queue-id", id); var progressBar = $("
").addClass("progress-bar progress-bar-striped active") @@ -3060,10 +3065,12 @@ function startQueueSpinner(id) { progress.appendTo($("#addfromurl")); } -function stopQueueSpinner(id) { - if (id && $("#queueprogress").data("queue-id") === id) { - $("#queueprogress").remove(); - } else if (id === null) { +function stopQueueSpinner(data) { + var shouldRemove = (typeof data === 'object' && + $("#queueprogress").data("queue-id") === data.id); + shouldRemove = shouldRemove || data === null; + shouldRemove = shouldRemove || $("#queueprogress").data("queue-id") === "$any"; + if (shouldRemove) { $("#queueprogress").remove(); } }