User:Ahonc/markadmins.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)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// importScript('User:Ahonc/markadmins.js');
//Based on [[ru:Участник:Obersachse/markadmins.js]]
//<pre>
var userSet = new Object();
var userSetTip = new Object();
$(markUsers);
function markUsers(){
var body, lnk, href, title, mm, user, mark, i, k;
if (!(body = document.getElementById('bodyContent'))) return;
var links = body.getElementsByTagName('A');
for (i=0; i<links.length; i++){
lnk = links[i];
if (!lnk.title || ! (mm=lnk.title.match('User:(.*)'))) continue
user = '|' + decodeURIComponent(mm[1]) + '|';
for (k in userSet){
if (userSet[k].indexOf(user) < 0) continue;
mark = document.createElement('b');
mark.appendChild(document.createTextNode('(' + k + ')'));
if (userSetTip[k]) lnk.title += userSetTip[k];
lnk.appendChild(mark);
}
}
}
//</pre>