diff --git a/templates/channel.jade b/templates/channel.jade index 084c0951..a453015a 100644 --- a/templates/channel.jade +++ b/templates/channel.jade @@ -181,5 +181,6 @@ html(lang="en") // $('#channeloptions a[href="#cs-miscoptions"]').tab('show'); script(src="/assets/js/data.js") script(src="/assets/js/util.js") + script(src="/assets/js/paginator.js") script(src="/assets/js/ui.js") script(src="/assets/js/callbacks.js") diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index 5f069945..a420032a 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -619,6 +619,10 @@ Callbacks = { /* REGION Rank Stuff */ rank: function(r) { + if (r > -1) { + $("#guestlogin").hide(); + $("#chatline").show(); + } if(r >= 255) SUPERADMIN = true; CLIENT.rank = r; @@ -657,13 +661,6 @@ Callbacks = { } }, - /* should not be relevant since registration is on account.html */ - register: function(data) { - if(data.error) { - alert(data.error); - } - }, - login: function(data) { if(!data.success) { if(data.error != "Session expired") { @@ -671,17 +668,8 @@ Callbacks = { } } else { - $("#welcome").text("Logged in as " + data.name); - $("#loginform").css("display", "none"); - $("#logoutform").css("display", ""); - $("#loggedin").css("display", ""); - SESSION = data.session || ""; CLIENT.name = data.name; CLIENT.logged_in = true; - if(SESSION) { - createCookie("cytube_uname", CLIENT.name, 7); - createCookie("cytube_session", SESSION, 7); - } } }, @@ -709,7 +697,7 @@ Callbacks = { }, userlist: function(data) { - $(".userlist_item").each(function() { $(this).remove(); }); + $(".userlist_item").remove(); for(var i = 0; i < data.length; i++) { Callbacks.addUser(data[i]); } @@ -722,11 +710,11 @@ Callbacks = { user.remove(); var div = $("
") .addClass("userlist_item"); - var flair = $("").appendTo(div); + var icon = $("").appendTo(div); var nametag = $("").text(data.name).appendTo(div); div.data("name", data.name); div.data("rank", data.rank); - div.data("leader", false); + div.data("leader", Boolean(data.leader)); div.data("profile", data.profile); div.data("icon", data.meta.icon); div.data("afk", data.meta.afk); @@ -746,7 +734,7 @@ Callbacks = { setLeader: function (name) { $(".userlist_item").each(function () { - $(this).find(".icon-star-empty").remove(); + $(this).find(".glyphicon-star-empty").remove(); if ($(this).data("leader")) { $(this).data("leader", false); addUserDropdown($(this)); @@ -808,43 +796,6 @@ Callbacks = { formatUserlistItem(user); }, - /* DEPRECATED - SEE: - - setUserIcon - - setAFK - - setLeader - - setUserProfile - - setUserRank - */ - updateUser: function(data) { - if(data.name == CLIENT.name) { - CLIENT.leader = data.leader; - CLIENT.rank = data.rank; - handlePermissionChange(); - if(CLIENT.leader) { - // I'm a leader! Set up sync function - if(LEADTMR) - clearInterval(LEADTMR); - LEADTMR = setInterval(sendVideoUpdate, 5000); - } - // I'm not a leader. Don't send syncs to the server - else { - if(LEADTMR) - clearInterval(LEADTMR); - LEADTMR = false; - } - - } - var user = findUserlistItem(data.name); - if(user !== null) { - user.data("rank", data.rank); - formatUserlistItem(user, data); - addUserDropdown(user, data); - if(USEROPTS.sort_rank) - sortUserlist(); - } - }, - setAFK: function (data) { var user = findUserlistItem(data.name); if(user === null) @@ -940,7 +891,7 @@ Callbacks = { }, queueFail: function (data) { - queueMessage(data, "alert-error"); + queueMessage(data, "alert-danger"); }, setTemp: function(data) { @@ -1038,16 +989,16 @@ Callbacks = { .addClass("btn-success") .attr("title", "Playlist Unlocked"); $("#qlockbtn").find("i") - .removeClass("icon-lock") - .addClass("icon-ok"); + .removeClass("glyphicon-lock") + .addClass("glyphicon-ok"); } else { $("#qlockbtn").removeClass("btn-success") .addClass("btn-danger") .attr("title", "Playlist Locked"); $("#qlockbtn").find("i") - .removeClass("icon-ok") - .addClass("icon-lock"); + .removeClass("glyphicon-ok") + .addClass("glyphicon-lock"); } }, @@ -1055,8 +1006,7 @@ Callbacks = { $("#search_clear").remove(); clearSearchResults(); $("#library").data("entries", data.results); - $("").addClass("btn btn-block") - .addClass("span12") + $("").addClass("btn btn-default btn-sm btn-block") .css("margin-left", "0") .attr("id", "search_clear") .text("Clear Results") @@ -1102,7 +1052,7 @@ Callbacks = { .appendTo(poll) .click(function() { poll.remove(); }); if(hasPermission("pollctl")) { - $("").addClass("btn btn-danger pull-right").text("End Poll") + $("").addClass("btn btn-danger btn-sm pull-right").text("End Poll") .appendTo(poll) .click(function() { socket.emit("closePoll") @@ -1121,7 +1071,7 @@ Callbacks = { }); $(this).parent().addClass("option-selected"); } - $("").addClass("btn").text(data.counts[i]) + $("").addClass("btn btn-default btn-sm").text(data.counts[i]) .prependTo($("").addClass("option").html(data.options[i]) .appendTo(poll)) .click(callback); @@ -1159,7 +1109,7 @@ Callbacks = { makeAlert("Success", "Playlist saved.", "alert-success"); } else { - makeAlert("Error", data.error, "alert-error") + makeAlert("Error", data.error, "alert-danger") .addClass("span12") .insertBefore($("#userpl_list")); } @@ -1167,8 +1117,7 @@ Callbacks = { listPlaylists: function(data) { if(data.error) { - makeAlert("Error", data.error, "alert-error") - .addClass("span12") + makeAlert("Error", data.error, "alert-danger") .insertBefore($("#userpl_list")); } else { @@ -1200,9 +1149,9 @@ Callbacks = { .css("float", "left") .prependTo(li); var del = $("") - .addClass("btn btn-mini btn-danger") + .addClass("btn btn-xs btn-danger") .prependTo(bg); - $("").addClass("icon-trash").appendTo(del); + $("").addClass("glyphicon glyphicon-trash").appendTo(del); (function(li) { del.click(function() { var go = confirm("Are you sure you want to delete playlist '" + li.data("pl-name") + "'?"); @@ -1215,7 +1164,7 @@ Callbacks = { })(li); if(hasPermission("playlistaddlist")) { (function(li) { - $("").addClass("btn btn-mini") + $("").addClass("btn btn-xs btn-default") .text("End") .prependTo(bg) .click(function() { @@ -1228,7 +1177,7 @@ Callbacks = { if(hasPermission("playlistnext")) { (function(li) { - $("").addClass("btn btn-mini") + $("").addClass("btn btn-xs btn-default") .text("Next") .prependTo(bg) .click(function() { diff --git a/www/assets/js/util.js b/www/assets/js/util.js index 84b5b7a0..4019538f 100644 --- a/www/assets/js/util.js +++ b/www/assets/js/util.js @@ -53,6 +53,8 @@ function formatURL(data) { return "http://imgur.com/a/" + data.id; case "us": return "http://ustream.tv/" + data.id; + case "gd": + return data.id; default: return "#"; } @@ -117,18 +119,18 @@ function formatUserlistItem(div) { name.mouseleave(function() { profile.remove(); }); - var flair = div.children()[0]; - flair.innerHTML = ""; + var icon = div.children()[0]; + icon.innerHTML = ""; // denote current leader with a star if(data.leader) { - $("").addClass("icon-star-empty").appendTo(flair); + $("").addClass("glyphicon glyphicon-star-empty").appendTo(icon); } if(data.afk) { name.css("font-style", "italic"); - $("").addClass("icon-time").appendTo(flair); + $("").addClass("glyphicon glyphicon-time").appendTo(icon); } if (data.icon) { - $("").addClass(data.icon).prependTo(flair); + $("").addClass(data.icon).prependTo(icon); } } @@ -165,7 +167,7 @@ function addUserDropdown(entry) { */ if(CLIENT.rank >= 3 && CLIENT.rank > rank && rank > 0 && rank != 1.5) { var sel = $("") - .addClass("input-block-level") + .addClass("form-control") .appendTo(menu); $("").attr("value", "1").text("Regular User") .appendTo(sel); @@ -190,7 +192,7 @@ function addUserDropdown(entry) { } /* ignore button */ - var ignore = $("").addClass("btn btn-mini btn-block") + var ignore = $("").addClass("btn btn-xs btn-default btn-block") .appendTo(menu) .click(function () { if(IGNORED.indexOf(name) == -1) { @@ -209,7 +211,7 @@ function addUserDropdown(entry) { /* gib/remove leader (moderator+ only) */ if(CLIENT.rank >= 2) { - var ldr = $("").addClass("btn btn-mini btn-block") + var ldr = $("").addClass("btn btn-xs btn-default btn-block") .appendTo(menu); if(leader) { ldr.text("Remove Leader"); @@ -230,7 +232,7 @@ function addUserDropdown(entry) { /* kick button */ if(hasPermission("kick")) { - $("").addClass("btn btn-mini btn-block") + $("").addClass("btn btn-xs btn-default btn-block") .text("Kick") .click(function () { socket.emit("chatMsg", { @@ -242,7 +244,7 @@ function addUserDropdown(entry) { /* ban buttons */ if(hasPermission("ban")) { - $("").addClass("btn btn-mini btn-block") + $("").addClass("btn btn-xs btn-default btn-block") .text("Name Ban") .click(function () { socket.emit("chatMsg", { @@ -250,7 +252,7 @@ function addUserDropdown(entry) { }); }) .appendTo(menu); - $("").addClass("btn btn-mini btn-block") + $("").addClass("btn btn-xs btn-default btn-block") .text("IP Ban") .click(function () { socket.emit("chatMsg", { @@ -323,8 +325,8 @@ function sortUserlist() { list.sort(function (a, b) { var r1 = $(a).data("rank"); var r2 = $(b).data("rank"); - var afk1 = $(a).find(".icon-time").length > 0; - var afk2 = $(b).find(".icon-time").length > 0; + var afk1 = $(a).find(".glyphicon-time").length > 0; + var afk2 = $(b).find(".glyphicon-time").length > 0; var name1 = a.children[1].innerHTML.toLowerCase(); var name2 = b.children[1].innerHTML.toLowerCase(); @@ -422,8 +424,8 @@ function addQueueButtons(li) { var menu = $("").addClass("btn-group").appendTo(li); // Play if(hasPermission("playlistjump")) { - $("").addClass("btn btn-mini qbtn-play") - .html("Play") + $("").addClass("btn btn-xs btn-default qbtn-play") + .html("Play") .click(function() { socket.emit("jumpTo", li.data("uid")); }) @@ -431,8 +433,8 @@ function addQueueButtons(li) { } // Queue next if(hasPermission("playlistmove")) { - $("").addClass("btn btn-mini qbtn-next") - .html("Queue Next") + $("").addClass("btn btn-xs btn-default qbtn-next") + .html("