Remove debug message; stack queueFail messages clientside

This commit is contained in:
calzoneman 2013-09-30 21:54:01 -05:00
parent 0c52c3f17d
commit 54016f6f48
2 changed files with 21 additions and 3 deletions

View file

@ -1405,7 +1405,6 @@ Channel.prototype.addMedia = function(data, user) {
m.temp = data.temp; m.temp = data.temp;
var res = self.playlist.addMedia(m); var res = self.playlist.addMedia(m);
if (res.error) { if (res.error) {
console.log(res);
user.socket.emit("queueFail", res.error); user.socket.emit("queueFail", res.error);
q.release(); q.release();
return; return;

View file

@ -796,11 +796,30 @@ Callbacks = {
}, },
queueFail: function(data) { queueFail: function(data) {
if(!data) { if (!data) {
data = "Queue failed. Check your link to make sure it is valid."; data = "Queue failed. Check your link to make sure it is valid.";
} }
var alerts = $(".qfalert");
for (var i = 0; i < alerts.length; i++) {
var al = $(alerts[i]);
var cl = al.clone();
cl.children().remove();
if (cl.text() === data) {
var tag = al.find(".label-important");
if (tag.length > 0) {
var count = parseInt(tag.text().match(/\d+/)[0]) + 1;
tag.text(tag.text().replace(/\d+/, ""+count));
} else {
$("<span/>")
.addClass("label label-important pull-right")
.text("+ 1 more")
.appendTo(al);
}
return;
}
}
makeAlert("Error", data, "alert-error") makeAlert("Error", data, "alert-error")
.addClass("span12") .addClass("span12 qfalert")
.insertBefore($("#extended_controls")); .insertBefore($("#extended_controls"));
}, },