Add option for old-style playlist buttons (#174)

This commit is contained in:
calzoneman 2013-06-20 16:50:12 -04:00
parent 59df3924f8
commit 247862355c
2 changed files with 64 additions and 39 deletions

View File

@ -34,8 +34,10 @@ var CHANNEL = {
var PLAYER = false; var PLAYER = false;
var FLUIDLAYOUT = false; var FLUIDLAYOUT = false;
var VWIDTH = $("#ytapiplayer").parent().css("width").replace("px", ""); if($("ytapiplayer").length > 0) {
var VHEIGHT = ""+parseInt(parseInt(VWIDTH) * 9 / 16); var VWIDTH = $("#ytapiplayer").parent().css("width").replace("px", "");
var VHEIGHT = ""+parseInt(parseInt(VWIDTH) * 9 / 16);
}
var POSITION = -1; var POSITION = -1;
var socket = { var socket = {
emit: function() { emit: function() {
@ -77,19 +79,20 @@ function getOrDefault(k, def) {
} }
var USEROPTS = { var USEROPTS = {
theme : getOrDefault("theme", "default"), theme : getOrDefault("theme", "default"),
css : getOrDefault("css", ""), css : getOrDefault("css", ""),
layout : getOrDefault("layout", "default"), layout : getOrDefault("layout", "default"),
synch : getOrDefault("synch", true), synch : getOrDefault("synch", true),
hidevid : getOrDefault("hidevid", false), hidevid : getOrDefault("hidevid", false),
show_timestamps : getOrDefault("show_timestamps", true), show_timestamps : getOrDefault("show_timestamps", true),
modhat : getOrDefault("modhat", false), modhat : getOrDefault("modhat", false),
blink_title : getOrDefault("blink_title", false), blink_title : getOrDefault("blink_title", false),
sync_accuracy : getOrDefault("sync_accuracy", 2), sync_accuracy : getOrDefault("sync_accuracy", 2),
chatbtn : getOrDefault("chatbtn", false), chatbtn : getOrDefault("chatbtn", false),
altsocket : getOrDefault("altsocket", false), altsocket : getOrDefault("altsocket", false),
joinmessage : getOrDefault("joinmessage", true), joinmessage : getOrDefault("joinmessage", true),
qbtn_hide : getOrDefault("qbtn_hide", false) qbtn_hide : getOrDefault("qbtn_hide", false),
qbtn_idontlikechange : getOrDefault("qbtn_idontlikechange", false)
}; };
var Rank = { var Rank = {

View File

@ -261,17 +261,32 @@ function addQueueButtons(li) {
.appendTo(menu); .appendTo(menu);
} }
if(USEROPTS.qbtn_hide) if(USEROPTS.qbtn_hide && !USEROPTS.qbtn_idontlikechange)
menu.hide(); menu.hide();
li.contextmenu(function(ev) { // I DON'T LIKE CHANGE
ev.preventDefault(); if(USEROPTS.qbtn_idontlikechange) {
if(menu.css("display") == "none") menu.addClass("pull-left");
menu.show("blind"); menu.detach().prependTo(li);
else menu.find(".btn").each(function() {
menu.hide("blind"); // Clear icon
return false; var icon = $(this).find("i");
}); $(this).html("");
icon.appendTo(this);
});
menu.find(".qbtn-play").addClass("btn-success");
menu.find(".qbtn-delete").addClass("btn-danger");
}
else {
li.contextmenu(function(ev) {
ev.preventDefault();
if(menu.css("display") == "none")
menu.show("blind");
else
menu.hide("blind");
return false;
});
}
} }
function rebuildPlaylist() { function rebuildPlaylist() {
@ -331,11 +346,17 @@ function showOptionsMenu() {
addOption("", warn); addOption("", warn);
$("<hr>").appendTo(form); $("<hr>").appendTo(form);
var qbtncontainer = $("<label/>").addClass("checkbox") var hqbtncontainer = $("<label/>").addClass("checkbox")
.text("Hide playlist buttons by default"); .text("Hide playlist buttons by default");
var qbtn = $("<input/>").attr("type", "checkbox").appendTo(qbtncontainer); var hqbtn = $("<input/>").attr("type", "checkbox").appendTo(hqbtncontainer);
qbtn.prop("checked", USEROPTS.qbtn_hide); hqbtn.prop("checked", USEROPTS.qbtn_hide);
addOption("Playlist Buttons", qbtncontainer); addOption("Playlist Buttons", hqbtncontainer);
var oqbtncontainer = $("<label/>").addClass("checkbox")
.text("Old style playlist buttons");
var oqbtn = $("<input/>").attr("type", "checkbox").appendTo(oqbtncontainer);
oqbtn.prop("checked", USEROPTS.qbtn_idontlikechange);
addOption("Playlist Buttons (Old)", oqbtncontainer);
var synchcontainer = $("<label/>").addClass("checkbox") var synchcontainer = $("<label/>").addClass("checkbox")
.text("Synchronize Media"); .text("Synchronize Media");
@ -407,17 +428,18 @@ function showOptionsMenu() {
.appendTo(footer); .appendTo(footer);
submit.click(function() { submit.click(function() {
USEROPTS.theme = themeselect.val(); USEROPTS.theme = themeselect.val();
USEROPTS.css = usercss.val(); USEROPTS.css = usercss.val();
USEROPTS.layout = layoutselect.val(); USEROPTS.layout = layoutselect.val();
USEROPTS.synch = synch.prop("checked"); USEROPTS.synch = synch.prop("checked");
USEROPTS.sync_accuracy = parseFloat(syncacc.val()) || 2; USEROPTS.sync_accuracy = parseFloat(syncacc.val()) || 2;
USEROPTS.hidevid = hidevid.prop("checked"); USEROPTS.hidevid = hidevid.prop("checked");
USEROPTS.show_timestamps = showts.prop("checked"); USEROPTS.show_timestamps = showts.prop("checked");
USEROPTS.blink_title = blink.prop("checked"); USEROPTS.blink_title = blink.prop("checked");
USEROPTS.chatbtn = sendbtn.prop("checked"); USEROPTS.chatbtn = sendbtn.prop("checked");
USEROPTS.altsocket = altsocket.prop("checked"); USEROPTS.altsocket = altsocket.prop("checked");
USEROPTS.qbtn_hide = qbtn.prop("checked"); USEROPTS.qbtn_hide = hqbtn.prop("checked");
USEROPTS.qbtn_idontlikechange = oqbtn.prop("checked");
if(CLIENT.rank >= Rank.Moderator) { if(CLIENT.rank >= Rank.Moderator) {
USEROPTS.modhat = modhat.prop("checked"); USEROPTS.modhat = modhat.prop("checked");
USEROPTS.joinmessage = join.prop("checked"); USEROPTS.joinmessage = join.prop("checked");