From 072695995e4d4d5565143aef548df91b7d064d63 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Sat, 22 Jun 2013 19:38:44 -0400 Subject: [PATCH] Add superadmin flair command for no good reason --- chatcommand.js | 23 +++++++++++++++++++++ www/assets/js/callbacks.js | 42 +++++++++++++++++++++++++++++++++----- www/assets/js/util.js | 9 ++++++++ 3 files changed, 69 insertions(+), 5 deletions(-) diff --git a/chatcommand.js b/chatcommand.js index 89d77f73..fd497dfc 100644 --- a/chatcommand.js +++ b/chatcommand.js @@ -32,6 +32,29 @@ function handle(chan, user, msg, data) { chan.chainMessage(user, msg.substring(3), {modflair: user.rank}) } } + else if(msg.indexOf("/a ") == 0) { + if(user.rank >= Rank.Siteadmin) { + var flair = { + superadminflair: { + labelclass: "label-important", + icon: "icon-globe" + } + }; + var args = msg.substring(3).split(" "); + var cargs = []; + for(var i = 0; i < args.length; i++) { + var a = args[i]; + if(a.indexOf("!icon-") == 0) + flair.superadminflair.icon = a.substring(1); + else if(a.indexOf("!label-") == 0) + flair.superadminflair.labelclass = a.substring(1); + else { + cargs.push(a); + } + } + chan.chainMessage(user, cargs.join(" "), flair); + } + } else if(msg.indexOf("/kick ") == 0) { handleKick(chan, user, msg.substring(6).split(" ")); } diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index a6183d37..4fb9f995 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -1,11 +1,11 @@ /* The MIT License (MIT) Copyright (c) 2013 Calvin Montgomery - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ @@ -364,7 +364,6 @@ Callbacks = { // I originally added this check because of a race condition // Now it seems to work without but I don't trust it if(!tbl.hasClass("table")) { - console.log("thing"); setTimeout(function() { Callbacks.banlist(entries); }, 100); @@ -424,7 +423,6 @@ Callbacks = { // I originally added this check because of a race condition // Now it seems to work without but I don't trust it if(!tbl.hasClass("table")) { - console.log("thing"); setTimeout(function() { Callbacks.channelRanks(entries); }, 100); @@ -484,8 +482,42 @@ Callbacks = { /* REGION Rank Stuff */ rank: function(r) { + if(r >= 255) + SUPERADMIN = true; CLIENT.rank = r; handlePermissionChange(); + if(SUPERADMIN && $("#setrank").length == 0) { + $("").attr("href", "/acp.html") + .attr("target", "_blank") + .text("ACP") + .appendTo($("
  • ").appendTo($(".nav")[0])); + var li = $("
  • ").addClass("dropdown") + .attr("id", "setrank") + .appendTo($(".nav")[0]); + $("").addClass("dropdown-toggle") + .attr("data-toggle", "dropdown") + .attr("href", "javascript:void(0)") + .html("Set Rank ") + .appendTo(li); + var menu = $("