User:Spydar007/common.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* Local Bureaucrats - bureaucrat */ $.get(mw.util.wikiScript('api'), { action: 'query', list: 'allusers', augroup: 'bureaucrat', aulimit: 500, format: 'json' }, function(data) { var au = data.query.allusers; for (var i in au) { var user = au[i].name, enc = encodeURIComponent(user); enc = enc.replace(/\%20/g,"_"); $.get(mw.util.wikiScript('api'), { action: 'query', list: 'users', usprop: 'groups', ususers: user, format: 'json' }, function(data) { var groups = data.query.users[0].groups; var user = data.query.users[0].name; if(groups.indexOf("sysop") == -1) { enc = encodeURIComponent(user); enc = enc.replace(/\%20/g,"_"); if(groups.indexOf("bot") > -1) { $('a[href$="User:' + enc + '"]').each(function() { $(this).attr('style', 'color: purple !important; font-weight: bold !important; font-style: italic !important;'); }); } else { $('a[href$="User:' + enc + '"]').each(function() { $(this).attr('style', 'color: purple !important; font-weight: bold !important;'); }); } } }); } }); /* Local Administrators - sysop */ $.get(mw.util.wikiScript('api'), { action: 'query', list: 'allusers', augroup: 'sysop', aulimit: 1000, format: 'json' }, function(data) { var au = data.query.allusers; for (var i in au) { var user = au[i].name, enc = encodeURIComponent(user); enc = enc.replace(/\%20/g,"_"); $.get(mw.util.wikiScript('api'), { action: 'query', list: 'users', usprop: 'groups', ususers: user, format: 'json' }, function(data) { var groups = data.query.users[0].groups; var user = data.query.users[0].name; if(groups.indexOf("bureaucrat") > -1) { enc = encodeURIComponent(user); enc = enc.replace(/\%20/g,"_"); if(groups.indexOf("bot") > -1) { $('a[href$="User:' + enc + '"]').each(function() { $(this).attr('style', 'color: purple !important; font-weight: bold !important; font-style: italic !important;'); }); } else { $('a[href$="User:' + enc + '"]').each(function() { $(this).attr('style', 'color: purple !important; font-weight: bold !important;'); }); } } else { enc = encodeURIComponent(user); enc = enc.replace(/\%20/g,"_"); if(groups.indexOf("bot") > -1) { $('a[href$="User:' + enc + '"]').each(function() { $(this).attr('style', 'color: darkgreen !important; font-weight: bold !important; font-style: italic !important;'); }); } else { $('a[href$="User:' + enc + '"]').each(function() { $(this).attr('style', 'color: darkgreen !important; font-weight: bold !important;'); }); } } }); } }); /* Maintainers - maintainer */ $.get(mw.util.wikiScript('api'), { action: 'query', list: 'allusers', augroup: 'maintainer', aulimit: 500, format: 'json' }, function(data) { var au = data.query.allusers; for (var i in au) { var user = au[i].name, enc = encodeURIComponent(user); enc = enc.replace(/\%20/g,"_"); $('a[href$="User:' + enc + '"]').each(function() { $(this).attr('style', 'color: black !important; font-weight: bold !important;'); }); } }); /* Local Bots - bot */ $.get(mw.util.wikiScript('api'), { action: 'query', list: 'allusers', augroup: 'bot', aulimit: 500, format: 'json' }, function(data) { var au = data.query.allusers; for (var i in au) { var user = au[i].name, enc = encodeURIComponent(user); enc = enc.replace(/\%20/g,"_"); $.get(mw.util.wikiScript('api'), { action: 'query', list: 'users', usprop: 'groups', ususers: user, format: 'json' }, function(data) { var groups = data.query.users[0].groups; var user = data.query.users[0].name; if(groups.indexOf("sysop") == -1) { var user = au[i].name, enc = encodeURIComponent(user); enc = enc.replace(/\%20/g,"_"); $('a[href$="User:' + enc + '"]').each(function() { $(this).attr('style', 'color: gray !important; font-weight: bold !important; font-style: italic !important;'); }); } }); } }); /* Local Check Users - checkuser */ $.get(mw.util.wikiScript('api'), { action: 'query', list: 'allusers', augroup: 'checkuser', aulimit: 500, format: 'json' }, function(data) { var au = data.query.allusers; for (var i in au) { var user = au[i].name, enc = encodeURIComponent(user); enc = enc.replace(/\%20/g,"_"); $('a[href$="User:' + enc + '"]').each(function() { $(this).append('<img src="https://images.wikia.com/spydar007-test/images/1/14/Check_User_Icon.png" width="16" height="16"/>'); }); } }); /* Manual implementation for system accounts */ au = ["Abuse filter", "Delete page script", "Edit page script", "Maintenance script", "MediaWiki default"]; var i; for (i = 0; i < au.length; ++i) { enc = encodeURIComponent(au[i]); enc = enc.replace(/\%20/g,"_"); $('a[href$="User:' + enc + '"]').each(function() { $(this).append('<img src="https://images.wikia.com/spydar007-test/images/b/ba/Terminal_Icon.png" width="16" height="16"/>'); $(this).attr('style', 'font-style: italic !important;'); }); }