Gebruiker:Eelco/common.js: verschil tussen versies

Uit basis
Naar navigatie springen Naar zoeken springen
Geen bewerkingssamenvatting
Geen bewerkingssamenvatting
 
(7 tussenliggende versies door dezelfde gebruiker niet weergegeven)
Regel 1: Regel 1:


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


// Several examples of portlet links
// Several examples of portlet links


// Adds a link to your js file to the toolbox
// Make sure the utilities module is loaded (will only load if not already)
mw.util.addPortletLink ( 'p-tb', mw.util.getUrl( 'Special:MyPage/common.js' ), 'My JS', 'pt-myvector', 'Visit your js file');
mw.loader.using( 'mediawiki.util', function () {


// Add a link to the edit page for your Notes in your personal links
    // Wait for the page to be parsed
// Note: We assume that short/pretty URLs are in use with ?action, ideally you would check for that.
    $( document ).ready( function () {
mw.util.addPortletLink ( 'p-personal', mw.util.getUrl( 'Special:MyPage/Notes' ) + '?action=edit', 'My notes', 'pt-mynotes', 'Edit your personal notes' );
   
    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);
    }


// Adds a link to prefix index for the current page to the toolbox
        //see below "Portlets" subsection
mw.util.addPortletLink ( 'p-tb', mw.util.getUrl( 'Special:Prefixindex/' + mw.config.get( 'wgPageName' ) ), 'Prefixindex', 'tb-prefixindex');
        var link = mw.util.addPortletLink( 'p-cactions', '#', 'Wikify', 'ca-wikify', 'Mark for wikification');
        add_links();
        $( link ).click( function ( event ) {
            event.preventDefault();
            doQwikify();


// 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');
    } );
} );
 
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');
mw.loader.load('//www.mediawiki.org/w/index.php?title=MediaWiki:Tutorial-QuickRC.js&action=raw&ctype=text/javascript');

Huidige versie van 26 feb 2021 om 17:12

$('#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');