Jump to content

User:Guarapiranga/JWB on demand.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() {
    if( mw.config.get( "wgNamespaceNumber" ) < 0 ) return;
    mw.loader.using( [ "mediawiki.util", "mediawiki.api" ] ).then( function () {
        var link = mw.util.addPortletLink(
			'p-cactions',
			'https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Script',
			'JWB',
			'ca-jwb',
            "Open JavaScript Wiki Browser to make semi-automated edits"
		);
        if( !link ) return;
        link.addEventListener( "click", function () {
			$( document ).ready( function() {
				mw.loader.load('//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Joeytje50/JWB.js/load.js');
			} );
        } );
    } );
} );