Gebruiker:Eelco/common.js

Uit basis
Naar navigatie springen Naar zoeken springen

Opmerking: nadat u de wijzigingen hebt gepubliceerd is het wellicht nodig uw browsercache te legen.

  • Firefox / Safari: houd Shift ingedrukt terwijl u op Vernieuwen klikt of druk op Ctrl-F5 of Ctrl-R (⌘-Shift-R op een Mac)
  • Google Chrome: druk op Ctrl-Shift-R (⌘-Shift-R op een Mac)
  • Internet Explorer / Edge: houd Ctrl ingedrukt terwijl u op Vernieuwen klikt of druk op Ctrl-F5
  • Opera: druk op Ctrl-F5.
$('#content').css('border', 'solid 1px blue');

// Several examples of portlet links

// Make sure the utilities module is loaded (will only load if not already)
mw.loader.using( 'mediawiki.util', function () {

    // Wait for the page to be parsed
    $( document ).ready( function () { 
    	
    	console.log("User: " + mw.config.get("wgUserId") + " " + mw.config.get("wgUserName"));
    	console.log("Page: " + mw.config.get("wgPageName"));
    	console.log("Time: " + Date());
    	
    	var mymodules = document.getElementById("mymodules");
    	if (mymodules) {
    		get_mymodules(mymodules);
    	}	

        //see below "Portlets" subsection
        var link = mw.util.addPortletLink( 'p-cactions', '#', 'Wikify', 'ca-wikify', 'Mark for wikification'); 
        add_links();
        $( link ).click( function ( event ) {
            event.preventDefault();
            doQwikify();

        } );
    } );
} );

function add_links() {
	// Adds a link to your js file to the toolbox
	mw.util.addPortletLink ( 'p-tb', mw.util.getUrl( 'Special:MyPage/common.js' ), 'My JS', 'pt-myvector', 'Visit your js file');
	
	// Add a link to the edit page for your Notes in your personal links
	// Note: We assume that short/pretty URLs are in use with ?action, ideally you would check for that.
	mw.util.addPortletLink ( 'p-personal', mw.util.getUrl( 'Special:MyPage/Notes' ) + '?action=edit', 'My notes', 'pt-mynotes', 'Edit your personal notes' );
	
	// Adds a link to prefix index for the current page to the toolbox
	mw.util.addPortletLink ( 'p-tb', mw.util.getUrl( 'Special:Prefixindex/' + mw.config.get( 'wgPageName' ) ), 'Prefixindex', 'tb-prefixindex');
	
	// Adds a link to logs for your account
	mw.util.addPortletLink ( 'p-personal', mw.util.getUrl( 'Special:Log/' + mw.config.get( 'wgUserName' ) ), 'My logs', 'pt-mylogs');
}

mw.loader.load('//www.mediawiki.org/w/index.php?title=MediaWiki:Tutorial-QuickRC.js&action=raw&ctype=text/javascript');