No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
myGroups = mw.config.get("wgUserGroups"), |
myGroups = mw.config.get("wgUserGroups"), |
||
dominantGroup; |
dominantGroup; |
||
− | while (order.length > |
+ | while (order.length > 0) { |
var currGroup = order.shift(); |
var currGroup = order.shift(); |
||
if (myGroups.indexOf(currGroup) > -1) { |
if (myGroups.indexOf(currGroup) > -1) { |
Revision as of 15:33, 9 January 2015
$(function() {
var g = mw.config.get("wgUserGroups"),
order = ["bureaucrat", "sysop", "rollback"],
myGroups = mw.config.get("wgUserGroups"),
dominantGroup;
while (order.length > 0) {
var currGroup = order.shift();
if (myGroups.indexOf(currGroup) > -1) {
dominantGroup = currGroup;
break;
}
}
if (typeof dominantGroup === "string") {
var icons = {
"bureaucrat": "http://static4.wikia.nocookie.net/the-unwanted/images/0/09/Bcrat_Star.png",
"sysop": "http://static4.wikia.nocookie.net/the-unwanted/images/0/03/Admin_Star.png",
"rollback": "http://static2.wikia.nocookie.net/the-unwanted/images/8/8f/Rollback_Star.png"
};
$("body").addClass("cugroup-" + dominantGroup);
mw.util.addCSS(
'body.cugroup-' + dominantGroup + ' #ChatHeader > .User > .username:after {\n' +
'\tbackground-image: url(\'' + icons[dominantGroup] + '\');\n' +
'\tbackground-position: 0 0;\n' +
'}'
);
}
});