Work on unregistered channels; fixes
This commit is contained in:
parent
0603a02d2e
commit
b214c07fe0
10 changed files with 284 additions and 60 deletions
|
|
@ -143,20 +143,20 @@ Callbacks = {
|
|||
|
||||
channelNotRegistered: function() {
|
||||
var div = $("<div/>").addClass("alert alert-info")
|
||||
.attr("id", "chregnotice")
|
||||
.insertBefore($("#main"));
|
||||
$("<button/>").addClass("close pull-right").html("×")
|
||||
.appendTo($("<div/>").addClass("col-md-12").appendTo($("#announcements")));
|
||||
|
||||
$("<button/>").addClass("close pull-right")
|
||||
.appendTo(div)
|
||||
.click(function() { div.remove(); });
|
||||
$("<h3/>").text("This channel isn't registered").appendTo(div);
|
||||
$("<button/>").addClass("btn btn-primary").text("Register it")
|
||||
.attr("id", "chanregisterbtn")
|
||||
.appendTo(div)
|
||||
.click(function() {
|
||||
$(this).attr("disabled", true)
|
||||
.text("Registering...");
|
||||
socket.emit("registerChannel");
|
||||
});
|
||||
.click(function () {
|
||||
div.parent().remove();
|
||||
})
|
||||
.html("×");
|
||||
$("<h4/>").appendTo(div).text("Unregistered channel");
|
||||
$("<p/>").appendTo(div)
|
||||
.html("This channel is not registered to a CyTube account. You can still " +
|
||||
"use it, but some features will not be available. To register a " +
|
||||
"channel to your account, visit your <a href='/account/channels'>" +
|
||||
"channels</a> page.");
|
||||
},
|
||||
|
||||
registerChannel: function(data) {
|
||||
|
|
@ -427,15 +427,19 @@ Callbacks = {
|
|||
},
|
||||
|
||||
login: function(data) {
|
||||
if(!data.success) {
|
||||
if(data.error != "Session expired") {
|
||||
alert(data.error);
|
||||
if (!data.success) {
|
||||
if (data.error != "Session expired") {
|
||||
errDialog(data.error);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
CLIENT.name = data.name;
|
||||
CLIENT.guest = data.guest;
|
||||
CLIENT.logged_in = true;
|
||||
|
||||
if (!CLIENT.guest) {
|
||||
socket.emit("initUserPLCallbacks");
|
||||
socket.emit("listPlaylists");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -911,24 +915,16 @@ Callbacks = {
|
|||
}
|
||||
},
|
||||
|
||||
savePlaylist: function(data) {
|
||||
if(data.success) {
|
||||
makeAlert("Success", "Playlist saved.", "alert-success");
|
||||
}
|
||||
else {
|
||||
makeAlert("Error", data.error, "alert-danger")
|
||||
.addClass("span12")
|
||||
.insertBefore($("#userpl_list"));
|
||||
}
|
||||
},
|
||||
|
||||
listPlaylists: function(data) {
|
||||
$("#userpl_list").data("entries", data);
|
||||
formatUserPlaylistList();
|
||||
return;
|
||||
if(data.error) {
|
||||
makeAlert("Error", data.error, "alert-danger")
|
||||
.insertBefore($("#userpl_list"));
|
||||
}
|
||||
else {
|
||||
var pls = data.pllist;
|
||||
var pls = data;
|
||||
pls.sort(function(a, b) {
|
||||
var x = a.name.toLowerCase();
|
||||
var y = b.name.toLowerCase();
|
||||
|
|
@ -948,7 +944,7 @@ Callbacks = {
|
|||
if(pls[i].count != 1) {
|
||||
metastr += "s";
|
||||
}
|
||||
metastr +=", playtime " + pls[i].time;
|
||||
metastr +=", playtime " + pls[i].duration;
|
||||
$("<div/>").text(metastr)
|
||||
.css("float", "right")
|
||||
.appendTo(li);
|
||||
|
|
|
|||
|
|
@ -265,17 +265,13 @@ $("#youtube_search").click(function () {
|
|||
|
||||
/* user playlists */
|
||||
|
||||
$("#showplaylistmanager").click(function() {
|
||||
socket.emit("listPlaylists");
|
||||
});
|
||||
|
||||
$("#userpl_save").click(function() {
|
||||
if($("#userpl_name").val().trim() == "") {
|
||||
makeAlert("Invalid Name", "Playlist name cannot be empty", "alert-danger")
|
||||
.insertAfter($("#userpl_save").parent());
|
||||
return;
|
||||
}
|
||||
socket.emit("savePlaylist", {
|
||||
socket.emit("clonePlaylist", {
|
||||
name: $("#userpl_name").val()
|
||||
});
|
||||
});
|
||||
|
|
@ -482,7 +478,8 @@ $("#cs-chanranks-mod").click(chanrankSubmit.bind(this, 2));
|
|||
$("#cs-chanranks-adm").click(chanrankSubmit.bind(this, 3));
|
||||
$("#cs-chanranks-owner").click(chanrankSubmit.bind(this, 4));
|
||||
|
||||
["#showmediaurl", "#showsearch", "#showcustomembed"].forEach(function (id) {
|
||||
["#showmediaurl", "#showsearch", "#showcustomembed", "#showplaylistmanager"]
|
||||
.forEach(function (id) {
|
||||
$(id).click(function () {
|
||||
var wasActive = $(id).hasClass("active");
|
||||
$(".plcontrol-collapse").collapse("hide");
|
||||
|
|
|
|||
|
|
@ -563,7 +563,6 @@ function rebuildPlaylist() {
|
|||
function showUserOptions() {
|
||||
hidePlayer();
|
||||
$("#useroptions").on("hidden.bs.modal", function () {
|
||||
console.log("unhiding");
|
||||
unhidePlayer();
|
||||
});
|
||||
|
||||
|
|
@ -642,13 +641,15 @@ function storeOpts() {
|
|||
function applyOpts() {
|
||||
if ($("#usertheme").attr("href") !== USEROPTS.theme) {
|
||||
$("#usertheme").remove();
|
||||
if(USEROPTS.theme != "default") {
|
||||
$("<link/>").attr("rel", "stylesheet")
|
||||
.attr("type", "text/css")
|
||||
.attr("id", "usertheme")
|
||||
.attr("href", USEROPTS.theme)
|
||||
.appendTo($("head"));
|
||||
var theme = USEROPTS.theme;
|
||||
if (theme === "default") {
|
||||
theme = "/css/themes/default.css";
|
||||
}
|
||||
$("<link/>").attr("rel", "stylesheet")
|
||||
.attr("type", "text/css")
|
||||
.attr("id", "usertheme")
|
||||
.attr("href", theme)
|
||||
.appendTo($("head"));
|
||||
fixWeirdButtonAlignmentIssue();
|
||||
}
|
||||
|
||||
|
|
@ -881,13 +882,13 @@ function handlePermissionChange() {
|
|||
" style of playlist buttons.",
|
||||
"<br>"].join(""))
|
||||
.attr("id", "plonotification")
|
||||
.insertBefore($("#queue"));
|
||||
.insertAfter($("#queuefail"));
|
||||
|
||||
al.find(".close").remove();
|
||||
|
||||
$("<button/>").addClass("btn btn-primary")
|
||||
.text("Dismiss")
|
||||
.appendTo(al)
|
||||
.appendTo(al.find(".alert"))
|
||||
.click(function() {
|
||||
USEROPTS.first_visit = false;
|
||||
storeOpts();
|
||||
|
|
@ -2107,3 +2108,81 @@ function formatCSChatFilterList() {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
function formatTime(sec) {
|
||||
var h = Math.floor(sec / 3600) + "";
|
||||
var m = Math.floor((sec % 3600) / 60) + "";
|
||||
var s = sec % 60 + "";
|
||||
|
||||
if (h.length < 2) {
|
||||
h = "0" + h;
|
||||
}
|
||||
|
||||
if (m.length < 2) {
|
||||
m = "0" + m;
|
||||
}
|
||||
|
||||
if (s.length < 2) {
|
||||
s = "0" + s;
|
||||
}
|
||||
|
||||
if (h === "00") {
|
||||
return [m, s].join(":");
|
||||
} else {
|
||||
return [h, m, s].join(":");
|
||||
}
|
||||
}
|
||||
|
||||
function formatUserPlaylistList() {
|
||||
var list = $("#userpl_list").data("entries") || [];
|
||||
list.sort(function (a, b) {
|
||||
var x = a.name.toLowerCase();
|
||||
var y = b.name.toLowerCase();
|
||||
return x == y ? 0 : (x < y ? -1 : 1);
|
||||
});
|
||||
|
||||
$("#userpl_list").html("");
|
||||
list.forEach(function (pl) {
|
||||
var li = $("<li/>").addClass("queue_entry").appendTo($("#userpl_list"));
|
||||
var title = $("<span/>").addClass("qe_title").appendTo(li)
|
||||
.text(pl.name);
|
||||
var time = $("<span/>").addClass("pull-right").appendTo(li)
|
||||
.text(pl.count + " items, playtime " + formatTime(pl.duration));
|
||||
var clear = $("<div/>").addClass("qe_clear").appendTo(li);
|
||||
|
||||
var btns = $("<div/>").addClass("btn-group pull-left").prependTo(li);
|
||||
if (hasPermission("playlistadd")) {
|
||||
$("<button/>").addClass("btn btn-xs btn-default")
|
||||
.text("End")
|
||||
.appendTo(btns)
|
||||
.click(function () {
|
||||
socket.emit("queuePlaylist", {
|
||||
name: pl.name,
|
||||
pos: "end"
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (hasPermission("playlistadd") && hasPermission("playlistnext")) {
|
||||
$("<button/>").addClass("btn btn-xs btn-default")
|
||||
.text("Next")
|
||||
.prependTo(btns)
|
||||
.click(function () {
|
||||
socket.emit("queuePlaylist", {
|
||||
name: pl.name,
|
||||
pos: "next"
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$("<button/>").addClass("btn btn-xs btn-danger")
|
||||
.html("<span class='glyphicon glyphicon-trash'></span>")
|
||||
.attr("title", "Delete playlist")
|
||||
.appendTo(btns)
|
||||
.click(function () {
|
||||
socket.emit("deletePlaylist", {
|
||||
name: pl.name
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@
|
|||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
|
||||
#userpl_list {
|
||||
list-style: none outside none;
|
||||
margin-left: 0;
|
||||
|
|
@ -129,6 +130,7 @@
|
|||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
/*
|
||||
#userpl_list li {
|
||||
display: inline-block;
|
||||
line-height: 22px;
|
||||
|
|
@ -138,6 +140,7 @@
|
|||
padding: 2px;
|
||||
font-size: 8pt;
|
||||
}
|
||||
*/
|
||||
|
||||
#customembed_wrap {
|
||||
margin: 5px 0;
|
||||
|
|
@ -191,16 +194,20 @@
|
|||
background-image: url(/img/stripe-diagonal.png);
|
||||
}
|
||||
|
||||
#queue {
|
||||
.videolist {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#queue > li:last-child {
|
||||
border-bottom: 0;
|
||||
.videolist > li:last-child {
|
||||
border-bottom-width: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
#userpl_list > li:last-child {
|
||||
border-bottom-width: 1px;
|
||||
}
|
||||
|
||||
.videolist > li:first-child {
|
||||
border-top-width: 1px;
|
||||
}
|
||||
|
|
@ -435,6 +442,8 @@ li.ui-sortable-helper, li.ui-sortable-placeholder + li.queue_entry {
|
|||
|
||||
.qfalert {
|
||||
margin-bottom: 10px;
|
||||
padding-left: 0!important;
|
||||
padding-right: 0!important;
|
||||
}
|
||||
|
||||
#customembed-content {
|
||||
|
|
|
|||
|
|
@ -21,4 +21,3 @@ footer {
|
|||
.profile-box, .user-dropdown {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
css.setAttribute("rel", "stylesheet");
|
||||
css.setAttribute("type", "text/css");
|
||||
css.setAttribute("href", theme);
|
||||
css.setAttribute("id", "usertheme");
|
||||
document.head.appendChild(css);
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue