MediaWiki:Gadget-adminHighlight.js
Aller à la navigation
Aller à la recherche
Note : après avoir publié vos modifications, il se peut que vous deviez forcer le rechargement complet du cache de votre navigateur pour voir les changements.
- Firefox / Safari : maintenez la touche Maj (Shift) en cliquant sur le bouton Actualiser ou appuyez sur Ctrl + F5 ou Ctrl + R (⌘ + R sur un Mac).
- Google Chrome : appuyez sur Ctrl + Maj + R (⌘ + Shift + R sur un Mac).
- Internet Explorer / Edge : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl + F5.
- Opera : appuyez sur Ctrl + F5.
// page that contains the list of admins on this wiki:
var adminListPage = 'MediaWiki:Gadget-adminHighlight/AdminList.json';
// load array of admins
$.getJSON(encodeURIComponent(adminListPage) + '?action=raw&ctype=text/json').then(function(data) {
// add 'User:' to each admin name
var admins = data.map(function(username) { return 'User:' + username; });
mw.hook('wikipage.content').add(function() {
// for each link with a title attribute:
$('#mw-content-text a[title]').each(function() {
var $this = $(this);
var thisuser = $this.attr('title');
// check if the title attribute is in the list of admins
if (!$this.hasClass('admin-highlight') && $.inArray(thisuser, admins) > -1) {
$this.addClass('admin-highlight');
}
});
});
});