MediaWiki:Gadget-markAdmins.js: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m Oooops |
fix regex: sostituisci tutti gli underscore nei nomi utente, non solo il primo |
||
(3 versioni intermedie di 3 utenti non mostrate) | |||
Riga 4:
*
* This script needs the page [[Utente:ItwikiBot/AdminList]]
* @FixMe Find a better place to insert abbrs. The huge fantasy of wikipedians
* may produce weird results, e.g. breaking the username when half of it links
* to the user page, and the other half to the talk page. This should also avoid
* cases where the abbr inherits some CSS from the signature (currently handled
* with font-style: initial).
*/
Riga 31 ⟶ 36:
mw.hook( 'wikipage.content' ).add( function markAdmins ( $content ) {
mw.util.addCSS( 'abbr.adminMark { font-style: initial; font-weight: bold; padding-left: 5px; font-size: 0.7em; }' );
$.getJSON( '/wiki/' + cfgPage + '?action=raw&ctype=application/json', function processList ( response ) {
var userNs = mw.config.get( 'wgFormattedNamespaces' )[ 2 ],
Riga 39 ⟶ 44:
// for each link
$content.find( 'a' ).each( function addPerUserGroups () {
var $link = $( this ), userPatternMatch,
href = $link.attr( 'href' ),
userLink, userName, knownUserGroups, groupShort, groupName, i,
Riga 48 ⟶ 53:
// no sub pages
if( userLink && userLink.indexOf( '/' ) === -1 ) {
userName = decodeURIComponent( userLink.replace( /\/.*/, '' ).replace( /_/g, ' ' ) ); knownUserGroups = response.users[ userName ];
if ( knownUserGroups ) {
|