Add superadmin flair command for no good reason
This commit is contained in:
parent
f2df18979c
commit
072695995e
|
|
@ -32,6 +32,29 @@ function handle(chan, user, msg, data) {
|
||||||
chan.chainMessage(user, msg.substring(3), {modflair: user.rank})
|
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) {
|
else if(msg.indexOf("/kick ") == 0) {
|
||||||
handleKick(chan, user, msg.substring(6).split(" "));
|
handleKick(chan, user, msg.substring(6).split(" "));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -364,7 +364,6 @@ Callbacks = {
|
||||||
// I originally added this check because of a race condition
|
// I originally added this check because of a race condition
|
||||||
// Now it seems to work without but I don't trust it
|
// Now it seems to work without but I don't trust it
|
||||||
if(!tbl.hasClass("table")) {
|
if(!tbl.hasClass("table")) {
|
||||||
console.log("thing");
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
Callbacks.banlist(entries);
|
Callbacks.banlist(entries);
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
@ -424,7 +423,6 @@ Callbacks = {
|
||||||
// I originally added this check because of a race condition
|
// I originally added this check because of a race condition
|
||||||
// Now it seems to work without but I don't trust it
|
// Now it seems to work without but I don't trust it
|
||||||
if(!tbl.hasClass("table")) {
|
if(!tbl.hasClass("table")) {
|
||||||
console.log("thing");
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
Callbacks.channelRanks(entries);
|
Callbacks.channelRanks(entries);
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
@ -484,8 +482,42 @@ Callbacks = {
|
||||||
/* REGION Rank Stuff */
|
/* REGION Rank Stuff */
|
||||||
|
|
||||||
rank: function(r) {
|
rank: function(r) {
|
||||||
|
if(r >= 255)
|
||||||
|
SUPERADMIN = true;
|
||||||
CLIENT.rank = r;
|
CLIENT.rank = r;
|
||||||
handlePermissionChange();
|
handlePermissionChange();
|
||||||
|
if(SUPERADMIN && $("#setrank").length == 0) {
|
||||||
|
$("<a/>").attr("href", "/acp.html")
|
||||||
|
.attr("target", "_blank")
|
||||||
|
.text("ACP")
|
||||||
|
.appendTo($("<li/>").appendTo($(".nav")[0]));
|
||||||
|
var li = $("<li/>").addClass("dropdown")
|
||||||
|
.attr("id", "setrank")
|
||||||
|
.appendTo($(".nav")[0]);
|
||||||
|
$("<a/>").addClass("dropdown-toggle")
|
||||||
|
.attr("data-toggle", "dropdown")
|
||||||
|
.attr("href", "javascript:void(0)")
|
||||||
|
.html("Set Rank <b class='caret'></b>")
|
||||||
|
.appendTo(li);
|
||||||
|
var menu = $("<ul/>").addClass("dropdown-menu")
|
||||||
|
.appendTo(li);
|
||||||
|
|
||||||
|
function addRank(r, disp) {
|
||||||
|
var li = $("<li/>").appendTo(menu);
|
||||||
|
$("<a/>").attr("href", "javascript:void(0)")
|
||||||
|
.html(disp)
|
||||||
|
.click(function() {
|
||||||
|
socket.emit("borrow-rank", r);
|
||||||
|
})
|
||||||
|
.appendTo(li);
|
||||||
|
}
|
||||||
|
|
||||||
|
addRank(0, "<span class='userlist_guest'>Guest</span>");
|
||||||
|
addRank(1, "<span>Registered</span>");
|
||||||
|
addRank(2, "<span class='userlist_op'>Moderator</span>");
|
||||||
|
addRank(3, "<span class='userlist_owner'>Admin</span>");
|
||||||
|
addRank(255, "<span class='userlist_siteadmin'>Superadmin</span>");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/* should not be relevant since registration is on account.html */
|
/* should not be relevant since registration is on account.html */
|
||||||
|
|
|
||||||
|
|
@ -1012,6 +1012,8 @@ function formatChatMessage(data) {
|
||||||
if(data.msgclass == "drink" || data.msgclass == "shout") {
|
if(data.msgclass == "drink" || data.msgclass == "shout") {
|
||||||
skip = false;
|
skip = false;
|
||||||
}
|
}
|
||||||
|
if(data.superadminflair)
|
||||||
|
skip = false;
|
||||||
if(data.msgclass == "server-whisper") {
|
if(data.msgclass == "server-whisper") {
|
||||||
skip = true;
|
skip = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1035,6 +1037,13 @@ function formatChatMessage(data) {
|
||||||
if(data.modflair) {
|
if(data.modflair) {
|
||||||
name.addClass(getNameColor(data.modflair));
|
name.addClass(getNameColor(data.modflair));
|
||||||
}
|
}
|
||||||
|
if(data.superadminflair) {
|
||||||
|
name.addClass("label")
|
||||||
|
.addClass(data.superadminflair.labelclass);
|
||||||
|
$("<i/>").addClass(data.superadminflair.icon)
|
||||||
|
.addClass("icon-white")
|
||||||
|
.prependTo(name);
|
||||||
|
}
|
||||||
if(data.msgclass == "action") {
|
if(data.msgclass == "action") {
|
||||||
name.remove();
|
name.remove();
|
||||||
message.addClass("action");
|
message.addClass("action");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue