« MediaWiki:Common.js » : différence entre les versions
Aller à la navigation
Aller à la recherche
Aucun résumé des modifications Balise : Révoqué |
Aucun résumé des modifications Balise : Révocation manuelle |
||
| Ligne 1 : | Ligne 1 : | ||
// First wait for mediawiki.util to load, and the page to be ready. | // First wait for mediawiki.util to load, and the page to be ready. | ||
$.when( mw.loader.using( 'mediawiki.util' ), $.ready ).then( function () { | $.when( mw.loader.using( 'mediawiki.util' ), $.ready ).then( function () { | ||
Version du 2 janvier 2022 à 18:34
// First wait for mediawiki.util to load, and the page to be ready.
$.when( mw.loader.using( 'mediawiki.util' ), $.ready ).then( function () {
// General usage pattern:
// mw.util.addPortletLink( portletId, href, text /* Optional: , id, tooltip, accesskey, nextnode */ );
// Example: Add a link to mediawiki.org to the Tools area, above the "Special pages" link.
var newElement = mw.util.addPortletLink(
'p-tb',
'https://www.mediawiki.org/',
'Link to mediawiki.org',
't-mworg',
'Go to www.mediawiki.org',
'm',
'#t-specialpages'
);
// The old way of passing a DOM-node also works
mw.util.addPortletLink(
'p-tb',
'https://www.mediawiki.org/',
'Link to mediawiki.org',
't-mworg',
'Go to www.mediawiki.org',
'm',
document.getElementById( 't-specialpages' )
);
} );