Gebruiker:Eelco/common.js: verschil tussen versies
Naar navigatie springen
Naar zoeken springen
Geen bewerkingssamenvatting |
Geen bewerkingssamenvatting |
||
Regel 4: | Regel 4: | ||
// Several examples of portlet links | // Several examples of portlet links | ||
// | // Make sure the utilities module is loaded (will only load if not already) | ||
mw. | mw.loader.using( 'mediawiki.util', function () { | ||
// | // Wait for the page to be parsed | ||
$( document ).ready( function () { | |||
// | //see below "Portlets" subsection | ||
mw.util.addPortletLink ( 'p- | 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'); |
Versie van 21 dec 2019 12:24
$('#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 () {
//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');