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() {
@ -89,7 +91,8 @@ var USEROPTS = {
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,9 +261,23 @@ function addQueueButtons(li) {
.appendTo(menu); .appendTo(menu);
} }
if(USEROPTS.qbtn_hide) if(USEROPTS.qbtn_hide && !USEROPTS.qbtn_idontlikechange)
menu.hide(); menu.hide();
// I DON'T LIKE CHANGE
if(USEROPTS.qbtn_idontlikechange) {
menu.addClass("pull-left");
menu.detach().prependTo(li);
menu.find(".btn").each(function() {
// Clear icon
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) { li.contextmenu(function(ev) {
ev.preventDefault(); ev.preventDefault();
if(menu.css("display") == "none") if(menu.css("display") == "none")
@ -272,6 +286,7 @@ function addQueueButtons(li) {
menu.hide("blind"); menu.hide("blind");
return false; 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");
@ -417,7 +438,8 @@ function showOptionsMenu() {
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");