MediaWiki:HighlightGroups.js

var highlightParams = { action: 'query', format: 'json', list: 'allusers', aulimit: '500', auprop: 'groups', augroup: 'bot|bureaucrat|sysop|moderator|rollbacker', },	HighlightAPI = new mw.Api; HighlightAPI.get( highlightParams ).done( function ( data ) {	var users = data.query.allusers,		u,               highlight;	for ( u in users ) { highlight += users[ u ].name + '|';	} var params = {		action: 'query',		list: 'users',		ususers: highlight,		usprop: 'groups',		format: 'json'	},	api = new mw.Api;

api.get( params ).done( function ( data ) {	var users = data.query.users,		u, highlightGroups;	for ( u in users ) { if(users[ u ].groups != undefined){

if(users[ u ].groups.includes('bot')){ highlightGroups += ((('#mw-content a[href*="' + users[ u ].name.replace(/ /g, '_') + '"]' + '{\n   color:var(--highlight-bot);\n}\n')).replace(',{','{')); }else if(users[ u ].groups.includes('bureaucrat')){ highlightGroups += ((('#mw-content a[href*="' + users[ u ].name.replace(/ /g, '_') + '"]' + '{\n   color:var(--highlight-bureaucrat);\n}\n')).replace(',{','{')); }else if(users[ u ].groups.includes('sysop')){ highlightGroups += ((('#mw-content a[href*="' + users[ u ].name.replace(/ /g, '_') + '"]' + '{\n   color:var(--highlight-sysop);\n}\n')).replace(',{','{')); }else if(users[ u ].groups.includes('moderator')){ highlightGroups += ((('#mw-content a[href*="' + users[ u ].name.replace(/ /g, '_') + '"]' + '{\n   color:var(--highlight-moderator);\n}\n')).replace(',{','{')); }else if(users[ u ].groups.includes('rollbacker')){ highlightGroups += ((('#mw-content a[href*="' + users[ u ].name.replace(/ /g, '_') + '"]' + '{\n   color:var(--highlight-rollbacker);\n}')).replace(',{','{')); } }	}		mw.util.addCSS( highlightGroups.replace('undefined', '') );

} ); } )