Gebruiker:Eelco/common.js: verschil tussen versies

Uit basis
Naar navigatie springen Naar zoeken springen
Geen bewerkingssamenvatting
Geen bewerkingssamenvatting
Regel 13: Regel 13:
     console.log("Page: " + mw.config.get("wgPageName"));
     console.log("Page: " + mw.config.get("wgPageName"));
     console.log("Time: " + Date());
     console.log("Time: " + Date());
   
    var mymodules = document.getElementById("mymodules");
    if (mymodules) {
    get_mymodules(mymodules);
    }


         //see below "Portlets" subsection
         //see below "Portlets" subsection

Versie van 29 dec 2019 22:08

$('#content').css('border', 'solid 10px red');

// 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');