User:Epicgenius/sandbox.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
$( function() {
    var cats = document.getElementById( 'mw-hidden-catlinks' );
    if ( !cats ) {
        return;
    }
    function addContribsLink () {
		var contribsLink = $( '<span> ')
			.addClass( 'contributorslink-test plainlinks metadata nomobile noprint' )
			.append( $('<a>')
				.addClass( 'external' )
				.attr( 'href',
					'//tools.wmflabs.org/xtools/articleinfo/?wikilang='
					+ mw.config.get( 'wgContentLanguage' ) 
					+ '&wikifam=.wikipedia.org&grouped=on&page=' 
					+ encodeURIComponent( mw.config.get( 'wgPageName' ) ) )
				.text( 'Contributors' )
			);
		contribsLink.insertAfter( $( '#siteSub' ) );
    }
    cats = cats.getElementsByTagName( 'a' );
} );

importStylesheet ('MediaWiki:Gadget-ContributorsHack.css');