Continue working on client
This commit is contained in:
parent
afff414aad
commit
556f9eb9e7
|
|
@ -619,10 +619,6 @@ Callbacks = {
|
||||||
/* REGION Rank Stuff */
|
/* REGION Rank Stuff */
|
||||||
|
|
||||||
rank: function(r) {
|
rank: function(r) {
|
||||||
if (r > -1) {
|
|
||||||
$("#guestlogin").hide();
|
|
||||||
$("#chatline").show();
|
|
||||||
}
|
|
||||||
if(r >= 255)
|
if(r >= 255)
|
||||||
SUPERADMIN = true;
|
SUPERADMIN = true;
|
||||||
CLIENT.rank = r;
|
CLIENT.rank = r;
|
||||||
|
|
|
||||||
|
|
@ -52,14 +52,14 @@ $("#modflair").click(function () {
|
||||||
|
|
||||||
$("#adminflair").click(function () {
|
$("#adminflair").click(function () {
|
||||||
var m = $("#adminflair");
|
var m = $("#adminflair");
|
||||||
if (m.hasClass("label-important")) {
|
if (m.hasClass("label-danger")) {
|
||||||
USEROPTS.adminhat = false;
|
USEROPTS.adminhat = false;
|
||||||
m.removeClass("label-important")
|
m.removeClass("label-danger")
|
||||||
.addClass("label-default");
|
.addClass("label-default");
|
||||||
} else {
|
} else {
|
||||||
USEROPTS.adminhat = true;
|
USEROPTS.adminhat = true;
|
||||||
m.removeClass("label-default")
|
m.removeClass("label-default")
|
||||||
.addClass("label-important");
|
.addClass("label-danger");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -425,7 +425,7 @@ function addQueueButtons(li) {
|
||||||
// Play
|
// Play
|
||||||
if(hasPermission("playlistjump")) {
|
if(hasPermission("playlistjump")) {
|
||||||
$("<button/>").addClass("btn btn-xs btn-default qbtn-play")
|
$("<button/>").addClass("btn btn-xs btn-default qbtn-play")
|
||||||
.html("<span class='glyphicon glyphicon-play'></i>Play")
|
.html("<span class='glyphicon glyphicon-play'></span>Play")
|
||||||
.click(function() {
|
.click(function() {
|
||||||
socket.emit("jumpTo", li.data("uid"));
|
socket.emit("jumpTo", li.data("uid"));
|
||||||
})
|
})
|
||||||
|
|
@ -434,7 +434,7 @@ function addQueueButtons(li) {
|
||||||
// Queue next
|
// Queue next
|
||||||
if(hasPermission("playlistmove")) {
|
if(hasPermission("playlistmove")) {
|
||||||
$("<button/>").addClass("btn btn-xs btn-default qbtn-next")
|
$("<button/>").addClass("btn btn-xs btn-default qbtn-next")
|
||||||
.html("<span class='glyphicon glyphicon-share-alt'></i>Queue Next")
|
.html("<span class='glyphicon glyphicon-share-alt'></span>Queue Next")
|
||||||
.click(function() {
|
.click(function() {
|
||||||
socket.emit("moveMedia", {
|
socket.emit("moveMedia", {
|
||||||
from: li.data("uid"),
|
from: li.data("uid"),
|
||||||
|
|
@ -447,7 +447,7 @@ function addQueueButtons(li) {
|
||||||
if(hasPermission("settemp")) {
|
if(hasPermission("settemp")) {
|
||||||
var tempstr = li.data("temp")?"Make Permanent":"Make Temporary";
|
var tempstr = li.data("temp")?"Make Permanent":"Make Temporary";
|
||||||
$("<button/>").addClass("btn btn-xs btn-default qbtn-tmp")
|
$("<button/>").addClass("btn btn-xs btn-default qbtn-tmp")
|
||||||
.html("<span class='glyphicon glyphicon-flag'></i>" + tempstr)
|
.html("<span class='glyphicon glyphicon-flag'></span>" + tempstr)
|
||||||
.click(function() {
|
.click(function() {
|
||||||
socket.emit("setTemp", {
|
socket.emit("setTemp", {
|
||||||
uid: li.data("uid"),
|
uid: li.data("uid"),
|
||||||
|
|
@ -459,7 +459,7 @@ function addQueueButtons(li) {
|
||||||
// Delete
|
// Delete
|
||||||
if(hasPermission("playlistdelete")) {
|
if(hasPermission("playlistdelete")) {
|
||||||
$("<button/>").addClass("btn btn-xs btn-default qbtn-delete")
|
$("<button/>").addClass("btn btn-xs btn-default qbtn-delete")
|
||||||
.html("<span class='glyphicon glyphicon-trash'></i>Delete")
|
.html("<span class='glyphicon glyphicon-trash'></span>Delete")
|
||||||
.click(function() {
|
.click(function() {
|
||||||
socket.emit("delete", li.data("uid"));
|
socket.emit("delete", li.data("uid"));
|
||||||
})
|
})
|
||||||
|
|
@ -829,90 +829,12 @@ function applyOpts() {
|
||||||
|
|
||||||
applyOpts();
|
applyOpts();
|
||||||
|
|
||||||
function showLoginMenu() {
|
|
||||||
hidePlayer();
|
|
||||||
var modal = $("<div/>").addClass("modal hide fade")
|
|
||||||
.appendTo($("body"));
|
|
||||||
var head = $("<div/>").addClass("modal-header")
|
|
||||||
.appendTo(modal);
|
|
||||||
$("<button/>").addClass("close")
|
|
||||||
.attr("data-dismiss", "modal")
|
|
||||||
.attr("aria-hidden", "true")
|
|
||||||
.appendTo(head)
|
|
||||||
.html("×");
|
|
||||||
$("<h3/>").text("Login").appendTo(head);
|
|
||||||
var body = $("<div/>").addClass("modal-body").appendTo(modal);
|
|
||||||
var frame = $("<iframe/>")
|
|
||||||
.attr("id", "loginframe")
|
|
||||||
.attr("src", "login.html")
|
|
||||||
.css("border", "none")
|
|
||||||
.css("width", "100%")
|
|
||||||
.css("height", "300px")
|
|
||||||
.css("margin", "0")
|
|
||||||
.appendTo(body);
|
|
||||||
var timer = setInterval(function() {
|
|
||||||
frame[0].contentWindow.postMessage("cytube-syn", document.location);
|
|
||||||
}, 1000);
|
|
||||||
var respond = function(e) {
|
|
||||||
if(e.data == "cytube-ack") {
|
|
||||||
clearInterval(timer);
|
|
||||||
}
|
|
||||||
if(e.data.indexOf(":") == -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(e.data.substring(0, e.data.indexOf(":")) == "cytube-login") {
|
|
||||||
var data = e.data.substring(e.data.indexOf(":")+1);
|
|
||||||
data = JSON.parse(data);
|
|
||||||
if(data.error) {
|
|
||||||
// Since this is the login page, invalid session implies bad credentials
|
|
||||||
if(data.error == "Invalid session") {
|
|
||||||
alert("Invalid username/password");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
alert(data.error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(data.success) {
|
|
||||||
SESSION = data.session || "";
|
|
||||||
CLIENT.name = data.uname || "";
|
|
||||||
socket.emit("login", {
|
|
||||||
name: CLIENT.name,
|
|
||||||
session: SESSION
|
|
||||||
});
|
|
||||||
if(window.removeEventListener) {
|
|
||||||
window.removeEventListener("message", respond, false);
|
|
||||||
}
|
|
||||||
else if(window.detachEvent) {
|
|
||||||
// If an IE dev ever reads this, please tell your company
|
|
||||||
// to get their shit together
|
|
||||||
window.detachEvent("onmessage", respond);
|
|
||||||
}
|
|
||||||
modal.modal("hide");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(window.addEventListener) {
|
|
||||||
window.addEventListener("message", respond, false);
|
|
||||||
}
|
|
||||||
else if(window.attachEvent) {
|
|
||||||
// If an IE dev ever reads this, please tell your company to get
|
|
||||||
// their shit together
|
|
||||||
window.attachEvent("onmessage", respond);
|
|
||||||
}
|
|
||||||
var footer = $("<div/>").addClass("modal-footer").appendTo(modal);
|
|
||||||
modal.on("hidden", function() {
|
|
||||||
unhidePlayer();
|
|
||||||
modal.remove();
|
|
||||||
});
|
|
||||||
modal.modal();
|
|
||||||
}
|
|
||||||
|
|
||||||
function showPollMenu() {
|
function showPollMenu() {
|
||||||
$("#pollwrap .poll-menu").remove();
|
$("#pollwrap .poll-menu").remove();
|
||||||
var menu = $("<div/>").addClass("well poll-menu")
|
var menu = $("<div/>").addClass("well poll-menu")
|
||||||
.insertAfter($("#newpollbtn"));
|
.prependTo($("#pollwrap"));
|
||||||
|
|
||||||
$("<button/>").addClass("btn btn-danger pull-right")
|
$("<button/>").addClass("btn btn-sm btn-danger pull-right")
|
||||||
.text("Cancel")
|
.text("Cancel")
|
||||||
.appendTo(menu)
|
.appendTo(menu)
|
||||||
.click(function() {
|
.click(function() {
|
||||||
|
|
@ -920,42 +842,36 @@ function showPollMenu() {
|
||||||
});
|
});
|
||||||
|
|
||||||
$("<strong/>").text("Title").appendTo(menu);
|
$("<strong/>").text("Title").appendTo(menu);
|
||||||
$("<br/>").appendTo(menu);
|
|
||||||
|
|
||||||
var title = $("<input/>").attr("type", "text")
|
var title = $("<input/>").addClass("form-control")
|
||||||
|
.attr("type", "text")
|
||||||
.appendTo(menu);
|
.appendTo(menu);
|
||||||
$("<br/>").appendTo(menu);
|
|
||||||
|
|
||||||
var lbl = $("<label/>").addClass("checkbox")
|
var lbl = $("<label/>").addClass("checkbox")
|
||||||
.text("Hide poll results")
|
.text("Hide poll results")
|
||||||
.appendTo(menu);
|
.appendTo(menu);
|
||||||
var hidden = $("<input/>").attr("type", "checkbox")
|
var hidden = $("<input/>").attr("type", "checkbox")
|
||||||
.appendTo(lbl);
|
.appendTo(lbl);
|
||||||
$("<br/>").appendTo(menu);
|
|
||||||
|
|
||||||
$("<strong/>").text("Options").appendTo(menu);
|
$("<strong/>").text("Options").appendTo(menu);
|
||||||
$("<br/>").appendTo(menu);
|
|
||||||
|
|
||||||
var addbtn = $("<button/>").addClass("btn")
|
var addbtn = $("<button/>").addClass("btn btn-sm btn-default")
|
||||||
.text("Add Option")
|
.text("Add Option")
|
||||||
.appendTo(menu);
|
.appendTo(menu);
|
||||||
$("<br/>").appendTo(menu);
|
|
||||||
|
|
||||||
function addOption() {
|
function addOption() {
|
||||||
$("<input/>").attr("type", "text")
|
$("<input/>").addClass("form-control")
|
||||||
|
.attr("type", "text")
|
||||||
.addClass("poll-menu-option")
|
.addClass("poll-menu-option")
|
||||||
.insertBefore(addbtn);
|
.insertBefore(addbtn);
|
||||||
$("<br/>").insertBefore(addbtn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addbtn.click(addOption);
|
addbtn.click(addOption);
|
||||||
addOption();
|
addOption();
|
||||||
addOption();
|
addOption();
|
||||||
|
|
||||||
$("<br/>").appendTo(menu);
|
$("<button/>").addClass("btn btn-default btn-block")
|
||||||
$("<button/>").addClass("btn")
|
|
||||||
.text("Open Poll")
|
.text("Open Poll")
|
||||||
.addClass("btn-block")
|
|
||||||
.appendTo(menu)
|
.appendTo(menu)
|
||||||
.click(function() {
|
.click(function() {
|
||||||
var opts = []
|
var opts = []
|
||||||
|
|
@ -1057,26 +973,17 @@ function handleModPermissions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handlePermissionChange() {
|
function handlePermissionChange() {
|
||||||
if(CLIENT.rank >= 2 && $("#channelsettingswrap").length > 0) {
|
if(CLIENT.rank >= 2) {
|
||||||
$("#channelsettingswrap3").show();
|
handleModPermissions();
|
||||||
if($("#channelsettingswrap").html().trim() == "") {
|
|
||||||
$("#channelsettingswrap").load("channeloptions.html", handleModPermissions);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
handleModPermissions();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$("#channelsettingswrap").html("");
|
|
||||||
$("#channelsettingswrap3").hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setVisible("#userpltogglewrap", CLIENT.rank >= 1);
|
setVisible("#playlistmanagerwrap", CLIENT.rank >= 1);
|
||||||
|
|
||||||
setVisible("#modflair", CLIENT.rank >= 2);
|
setVisible("#modflair", CLIENT.rank >= 2);
|
||||||
setVisible("#adminflair", CLIENT.rank >= 255);
|
setVisible("#adminflair", CLIENT.rank >= 255);
|
||||||
|
setVisible("#guestlogin", CLIENT.rank < 0);
|
||||||
|
setVisible("#chatline", CLIENT.rank >= 0);
|
||||||
|
|
||||||
setVisible("#playlisttogglewrap", hasPermission("playlistadd"));
|
setVisible("#playlistcontrolswrap", hasPermission("playlistadd"));
|
||||||
$("#queue_next").attr("disabled", !hasPermission("playlistnext"));
|
$("#queue_next").attr("disabled", !hasPermission("playlistnext"));
|
||||||
$("#qlockbtn").attr("disabled", CLIENT.rank < 2);
|
$("#qlockbtn").attr("disabled", CLIENT.rank < 2);
|
||||||
|
|
||||||
|
|
@ -1092,7 +999,6 @@ function handlePermissionChange() {
|
||||||
" you right click). You can also choose to use the old",
|
" you right click). You can also choose to use the old",
|
||||||
" style of playlist buttons.",
|
" style of playlist buttons.",
|
||||||
"<br>"].join(""))
|
"<br>"].join(""))
|
||||||
.addClass("span12")
|
|
||||||
.attr("id", "plonotification")
|
.attr("id", "plonotification")
|
||||||
.insertBefore($("#queue"));
|
.insertBefore($("#queue"));
|
||||||
|
|
||||||
|
|
@ -1122,7 +1028,7 @@ function handlePermissionChange() {
|
||||||
|
|
||||||
setVisible("#clearplaylist", hasPermission("playlistclear"));
|
setVisible("#clearplaylist", hasPermission("playlistclear"));
|
||||||
setVisible("#shuffleplaylist", hasPermission("playlistshuffle"));
|
setVisible("#shuffleplaylist", hasPermission("playlistshuffle"));
|
||||||
setVisible("#customembed_btn", hasPermission("playlistaddcustom"));
|
setVisible("#customembedwrap", hasPermission("playlistaddcustom"));
|
||||||
if(!hasPermission("playlistaddcustom")) {
|
if(!hasPermission("playlistaddcustom")) {
|
||||||
$("#customembed_entry").hide();
|
$("#customembed_entry").hide();
|
||||||
$("#customembed_code").val("");
|
$("#customembed_code").val("");
|
||||||
|
|
@ -1178,7 +1084,7 @@ function addLibraryButtons(li, id, source) {
|
||||||
|
|
||||||
if(hasPermission("playlistadd")) {
|
if(hasPermission("playlistadd")) {
|
||||||
if(hasPermission("playlistnext")) {
|
if(hasPermission("playlistnext")) {
|
||||||
$("<button/>").addClass("btn btn-mini")
|
$("<button/>").addClass("btn btn-xs btn-default")
|
||||||
.text("Next")
|
.text("Next")
|
||||||
.click(function() {
|
.click(function() {
|
||||||
socket.emit("queue", {
|
socket.emit("queue", {
|
||||||
|
|
@ -1189,7 +1095,7 @@ function addLibraryButtons(li, id, source) {
|
||||||
})
|
})
|
||||||
.appendTo(btns);
|
.appendTo(btns);
|
||||||
}
|
}
|
||||||
$("<button/>").addClass("btn btn-mini")
|
$("<button/>").addClass("btn btn-xs btn-default")
|
||||||
.text("End")
|
.text("End")
|
||||||
.click(function() {
|
.click(function() {
|
||||||
socket.emit("queue", {
|
socket.emit("queue", {
|
||||||
|
|
@ -1201,8 +1107,8 @@ function addLibraryButtons(li, id, source) {
|
||||||
.appendTo(btns);
|
.appendTo(btns);
|
||||||
}
|
}
|
||||||
if(CLIENT.rank >= 2 && source === "library") {
|
if(CLIENT.rank >= 2 && source === "library") {
|
||||||
$("<button/>").addClass("btn btn-mini btn-danger")
|
$("<button/>").addClass("btn btn-xs btn-danger")
|
||||||
.html("<i class='icon-trash'></i>")
|
.html("<span class='glyphicon glyphicon-trash'></span>")
|
||||||
.click(function() {
|
.click(function() {
|
||||||
socket.emit("uncache", {
|
socket.emit("uncache", {
|
||||||
id: id
|
id: id
|
||||||
|
|
|
||||||
|
|
@ -456,3 +456,24 @@
|
||||||
#channeloptions .modal-header {
|
#channeloptions .modal-header {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pollwrap > div {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.option {
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.option-selected {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.option > button {
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.option-selected > button {
|
||||||
|
border-width: 3px !important;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue