Various fixes

This commit is contained in:
calzoneman 2014-01-14 00:52:56 -06:00
parent 87f44b69e0
commit b1e6f696e8
7 changed files with 85 additions and 87 deletions

View file

@ -796,12 +796,12 @@ Callbacks = {
: "Added by: Unknown");
if (data.after === "prepend") {
li.prependTo(q);
li.show("blind", function () {
li.show("fade", function () {
plq.release();
});
} else if (data.after === "append") {
li.appendTo(q);
li.show("blind", function () {
li.show("fade", function () {
plq.release();
});
} else {
@ -811,7 +811,7 @@ Callbacks = {
return;
}
li.insertAfter(liafter);
li.show("blind", function () {
li.show("fade", function () {
plq.release();
});
}
@ -854,7 +854,7 @@ Callbacks = {
PL_ACTION_QUEUE.queue(function (plq) {
PL_WAIT_SCROLL = true;
var li = $(".pluid-" + data.uid);
li.hide("blind", function() {
li.hide("fade", function() {
li.remove();
plq.release();
PL_WAIT_SCROLL = false;

View file

@ -270,65 +270,56 @@ $("#queue").sortable({
});
$("#queue").disableSelection();
// TODO no more comma separated queueing.
function queue(pos) {
if($("#customembed_code").val()) {
var title = false;
if($("#customembed_title").val()) {
title = $("#customembed_title").val();
}
socket.emit("queue", {
id: $("#customembed_code").val(),
title: title,
type: "cu",
pos: pos
});
$("#customembed_code").val("");
$("#customembed_title").val("");
return;
function queue(pos, src) {
if (!src) {
src = "url";
}
var links = $("#mediaurl").val().split(",");
var parsed = [];
links.forEach(function(link) {
var data = parseMediaLink(link);
if(data.id === null || data.type === null) {
makeAlert("Error", "Invalid link. Please double check it and remove extraneous information", "alert-danger")
.insertBefore($("#extended_controls"));
}
else {
$("#mediaurl").val("");
}
parsed.push({
id: data.id,
type: data.type
});
});
if(parsed.length > 1) {
if (src === "customembed") {
var title = $("#customembed-title").val();
if (!title) {
title = false;
}
var content = $("#customembed-content").val();
socket.emit("queue", {
id: false,
list: parsed,
type: "list",
pos: pos
id: content,
title: title,
pos: pos,
type: "cu"
});
}
else {
parsed[0].pos = pos;
socket.emit("queue", parsed[0]);
} else {
var link = $("#mediaurl").val();
var data = parseMediaLink(link);
if (data.id == null || data.type == null) {
makeAlert("Error", "Failed to parse link. Please check that it is correct",
"alert-danger")
.insertAfter($("#addfromurl"));
} else {
$("#mediaurl").val("");
socket.emit("queue", {
id: data.id,
type: data.type,
pos: pos
});
}
}
}
$("#queue_next").click(function() {
queue("next");
});
$("#queue_end").click(function() {
queue("end");
});
$("#queue_next").click(queue.bind(this, "next", "url"));
$("#queue_end").click(queue.bind(this, "end", "url"));
$("#ce_queue_next").click(queue.bind(this, "next", "customembed"));
$("#ce_queue_end").click(queue.bind(this, "end", "customembed"));
$("#mediaurl").keydown(function(ev) {
if(ev.keyCode == 13) {
queue("end");
if (ev.keyCode === 13) {
queue("end", "url");
}
});
$("#customembed-content").keydown(function(ev) {
if (ev.keyCode === 13) {
queue("end", "customembed");
}
});
@ -341,13 +332,6 @@ $("#voteskip").click(function() {
$("#voteskip").attr("disabled", true);
});
$("#customembed_btn").click(function () {
if($("#customembed_entry").css("display") == "none")
$("#customembed_entry").show("blind");
else
$("#customembed_entry").hide("blind");
});
$("#getplaylist").click(function() {
var callback = function(data) {
hidePlayer();

View file

@ -21,7 +21,7 @@ function makeAlert(title, text, klass) {
$("<strong/>").text(title).prependTo(al);
$("<button/>").addClass("close pull-right").html("&times;")
.click(function() {
al.hide("blind", function() {
al.hide("fade", function() {
al.remove();
});
})
@ -817,7 +817,7 @@ function handlePermissionChange() {
.click(function() {
USEROPTS.first_visit = false;
storeOpts();
al.hide("blind", function() {
al.hide("fade", function() {
al.remove();
});
});
@ -881,7 +881,7 @@ function addLibraryButtons(li, id, source) {
.addClass("pull-left")
.prependTo(li);
var type = (source === "library") ? undefined : source;
var type = (source === "library") ? "lib" : source;
if(hasPermission("playlistadd")) {
if(hasPermission("playlistnext")) {
@ -914,7 +914,7 @@ function addLibraryButtons(li, id, source) {
socket.emit("uncache", {
id: id
});
li.hide("blind", function() {
li.hide("fade", function() {
li.remove();
});
})
@ -999,17 +999,17 @@ function playlistMove(from, after, cb) {
var q = $("#queue");
if(after === "prepend") {
lifrom.hide("blind", function() {
lifrom.hide("fade", function() {
lifrom.detach();
lifrom.prependTo(q);
lifrom.show("blind", cb);
lifrom.show("fade", cb);
});
}
else if(after === "append") {
lifrom.hide("blind", function() {
lifrom.hide("fade", function() {
lifrom.detach();
lifrom.appendTo(q);
lifrom.show("blind", cb);
lifrom.show("fade", cb);
});
}
else {
@ -1018,10 +1018,10 @@ function playlistMove(from, after, cb) {
cb(false);
return;
}
lifrom.hide("blind", function() {
lifrom.hide("fade", function() {
lifrom.detach();
lifrom.insertAfter(liafter);
lifrom.show("blind", cb);
lifrom.show("fade", cb);
});
}
}