var BASE = WEB_URL + "/api/json/"; var AUTH = ""; var NO_WEBSOCKETS = false; /* init socket connection */ $.getScript(IO_URL+"/socket.io/socket.io.js", function() { try { if(NO_WEBSOCKETS) { var i = io.transports.indexOf("websocket"); if(i >= 0) io.transports.splice(i, 1); } socket = io.connect(IO_URL); setupCallbacks(); } catch(e) { Callbacks.disconnect(); } }); $("#login").click(showLoginMenu); $("#logout").click(function() { eraseCookie("cytube_uname"); eraseCookie("cytube_session"); document.location.reload(true); }); $("#panels .span12").each(function() { $(this).hide(); }); function menuHandler(liselect, panelselect) { $(liselect).click(function() { $("#panels .span12").each(function() { $(this).hide(); }); $(panelselect).show(); $("#menudd_title").text($(liselect).text()); }); } menuHandler("#show_logview", "#logview"); menuHandler("#show_announce", "#announcepanel"); menuHandler("#show_gbans", "#gbanpanel"); menuHandler("#show_userlookup", "#userlookup"); function tableResort(tbl, sortby) { if(tbl.data("sortby") == sortby) tbl.data("sort_desc", !tbl.data("sort_desc")); else tbl.data("sortby", sortby) loadPage(tbl, 0); } $("#userlookup_uid").click(function() { tableResort($("#userlookup table"), "id"); }); $("#userlookup_uname").click(function() { tableResort($("#userlookup table"), "uname"); }); $("#userlookup_rank").click(function() { tableResort($("#userlookup table"), "global_rank"); }); $("#userlookup_email").click(function() { tableResort($("#userlookup table"), "email"); }); menuHandler("#show_chanloaded", "#channellist"); $("#show_chanloaded").click(function() { socket.emit("acp-list-loaded"); }); $("#listloaded_refresh").click(function() { socket.emit("acp-list-loaded"); }); menuHandler("#show_actionlog", "#actionlog"); $("#show_actionlog").click(getActionLog); $("#actionlog_filter").click(function() { var tbl = $("#actionlog table"); var actions = $(this).val(); $("#actionlog tbody").remove(); var entries = []; tbl.data("allentries").forEach(function(e) { if(actions.indexOf(e.action) == -1) return; entries.push(e); }); $("#actionlog_pagination").remove(); if(entries.length > 20) { var pag = $("
").addClass("pagination") .attr("id", "actionlog_pagination") .insertAfter($("#actionlog table")); var btns = $("