MediaWiki:HighlightUsers/code.js

/* HighlightUsers by Bobogoobo * Changes color of links to specified groups and users */ (function($) {   var highlight = window.highlight || {}, selector = '', that;

if (highlight['selectAll']) { selector = 'a[href$=":';   } else {        selector = 'a[href="/wiki/User:'; }

for (var x in highlight) { that = highlight[x];

if (x === 'selectAll') { continue; } else if (x === 'users') { for (var user in that) { $(selector + user.replace(' ', '_') + '"]').css('color', that[user]);           }        } else {            (function(slim, shady) { //JavaScript doesn't like to cooperate with me                $.getJSON('/api.php?action=query&list=allusers&augroup=' + shady +                   '&aulimit=max&format=json', function(data) {                    var stuff = data.query.allusers, select = '';

for (var user in stuff) { select += selector + stuff[user].name.replace(' ', '_') + '"], ';                   }                    select = select.substring(0, select.length - 2);                    $(select).css('color', slim);                });            }(that, x));        }    } }(this.jQuery));