Add temporary videos

This commit is contained in:
calzoneman 2013-05-04 17:54:28 -05:00
parent 62e80cec63
commit 703ac3ce4f
12 changed files with 163 additions and 50 deletions

View file

@ -955,6 +955,15 @@ li.alert-info {
color: #ff9900;
}
li.alert-error {
border: 1px solid #cc0000;
color: #cc0000;
}
li.alert-error.alert-info {
color: #ff9900;
}
.btn, .btn:hover {
text-shadow: none;
color: #aaaaaa;

View file

@ -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);
}
});

View file

@ -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,

View file

@ -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);

View file

@ -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;
}

View file

@ -165,6 +165,10 @@
<input type="checkbox" id="opt_qopen_allow_playnext">
Allow anyone to jump to a video
</label>
<label class="checkbox">
<input type="checkbox" id="opt_qopen_temp">
Videos added by guests are temporary
</label>
</div>
<div class="span5">
<label>Page Title