Add temporary videos
This commit is contained in:
parent
62e80cec63
commit
703ac3ce4f
12 changed files with 163 additions and 50 deletions
|
|
@ -71,6 +71,7 @@ function initCallbacks() {
|
|||
$("#opt_qopen_allow_move").prop("checked", opts.qopen_allow_move);
|
||||
$("#opt_qopen_allow_delete").prop("checked", opts.qopen_allow_delete);
|
||||
$("#opt_qopen_allow_playnext").prop("checked", opts.qopen_allow_playnext);
|
||||
$("#opt_qopen_temp").prop("checked", opts.qopen_temp);
|
||||
$("#opt_pagetitle").attr("placeholder", opts.pagetitle);
|
||||
document.title = opts.pagetitle;
|
||||
PAGETITLE = opts.pagetitle;
|
||||
|
|
@ -284,6 +285,20 @@ function initCallbacks() {
|
|||
$(li).show("blind");
|
||||
});
|
||||
|
||||
socket.on("setTemp", function(data) {
|
||||
var li = $("#queue").children()[data.idx];
|
||||
var buttons = $(li).find(".qe_btn");
|
||||
if(buttons.length == 5) {
|
||||
$(buttons[4]).text(data.temp ? "Untemp" : "Temp");
|
||||
}
|
||||
if(data.temp) {
|
||||
$(li).addClass("alert alert-error");
|
||||
}
|
||||
else {
|
||||
$(li).removeClass("alert alert-error");
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("unqueue", function(data) {
|
||||
var li = $("#queue").children()[data.pos];
|
||||
$(li).remove();
|
||||
|
|
@ -308,7 +323,7 @@ function initCallbacks() {
|
|||
$("#voteskip").attr("disabled", false);
|
||||
});
|
||||
|
||||
socket.on("mediaUpdate", function(data) {
|
||||
socket.on("changeMedia", function(data) {
|
||||
$("#currenttitle").text("Currently Playing: " + data.title);
|
||||
if(data.type != "sc" && MEDIATYPE == "sc")
|
||||
// [](/goddamnitmango)
|
||||
|
|
@ -317,7 +332,13 @@ function initCallbacks() {
|
|||
MEDIATYPE = data.type;
|
||||
PLAYER = new Media(data);
|
||||
}
|
||||
else if(PLAYER.update) {
|
||||
if(PLAYER.update) {
|
||||
PLAYER.update(data);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("mediaUpdate", function(data) {
|
||||
if(PLAYER.update) {
|
||||
PLAYER.update(data);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -381,6 +381,7 @@ $("#opt_submit").click(function() {
|
|||
qopen_allow_move: $("#opt_qopen_allow_move").prop("checked"),
|
||||
qopen_allow_delete: $("#opt_qopen_allow_delete").prop("checked"),
|
||||
qopen_allow_playnext: $("#opt_qopen_allow_playnext").prop("checked"),
|
||||
qopen_temp: $("#opt_qopen_temp").prop("checked"),
|
||||
allow_voteskip: $("#opt_allow_voteskip").prop("checked"),
|
||||
voteskip_ratio: ratio,
|
||||
pagetitle: ptitle,
|
||||
|
|
|
|||
|
|
@ -256,6 +256,9 @@ function makeQueueEntry(video) {
|
|||
var time = $("<span />").addClass("qe_time").appendTo(li);
|
||||
time.text(video.duration);
|
||||
var clear = $("<div />").addClass("qe_clear").appendTo(li);
|
||||
if(video.temp) {
|
||||
li.addClass("alert alert-error");
|
||||
}
|
||||
return li;
|
||||
}
|
||||
|
||||
|
|
@ -326,6 +329,25 @@ function addQueueButtons(li) {
|
|||
});
|
||||
}
|
||||
|
||||
if(RANK >= Rank.Moderator) {
|
||||
var btnTemp = $("<button />").attr("class", "btn qe_btn").appendTo(btnstrip);
|
||||
var temp = $(li).hasClass("alert-error");
|
||||
if(temp) {
|
||||
btnTemp.text("Untemp");
|
||||
}
|
||||
else {
|
||||
btnTemp.text("Temp");
|
||||
}
|
||||
$(btnTemp).click(function() {
|
||||
temp = $(li).hasClass("alert-error");
|
||||
var idx = $("#queue").children().index(li);
|
||||
socket.emit("setTemp", {
|
||||
idx: idx,
|
||||
temp: !temp
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$(document).mouseup(function() {
|
||||
if(GRABBEDLI != null) {
|
||||
var idx = $("#queue").children().index(GRABBEDLI);
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ Media.prototype.initJWPlayer = function() {
|
|||
}
|
||||
|
||||
Media.prototype.update = function(data) {
|
||||
if(data.id != this.id) {
|
||||
if(data.id && data.id != this.id) {
|
||||
if(data.currentTime < 0) {
|
||||
data.currentTime = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue