User:Joe G/common.js

( function( $, mw ) { mw.loader.using( [ 'mediawiki.util', 'mediawiki.api', 'mediawiki.Title' ], function { var api = new mw.Api; var sysops = {}; var params = { list: 'allusers', augroup: 'sysop', aulimit: 'max' };   var load = function { api.get( params, {           ok: function( data ) {                $.each( data.query.allusers, function { sysops[this.name] = 1; } );               if ( data['query-continue'] ) {                    $.extend( params, data['query-continue'].allusers );                    load;                } else {                    $( function { $( 'a', mw.util.$content ).each( function {                           var $this = $( this );                            var title = $this.attr( 'title' );                            if ( !title ) {                                return;                            }                            if ( $this.hasClass( 'new' ) ) {                                title = title.replace( /[（\(][^）\)]+[）\)]$/, '' ); }                           title = new mw.Title( title ); if ( ( title.getNamespaceId & ~1 ) == 2 && sysops[title.getMainText.split( '/' )[0]] == 1                               || title.getNamespaceId == -1 && title.getMainText.indexOf( '/' ) != -1                                    && sysops[title.getMainText.split( '/' )[1]] == 1 ) { $this.css( 'background-color', '#FCFFB3' ).addClass( 'amalthea_userhighlighter_sysop' ); }                       } );                    } );                }            }        } );    };    load; } ); } )( jQuery, mediaWiki );