|
|
(13 versions intermédiaires par 2 utilisateurs non affichées) |
Ligne 1 : |
Ligne 1 : |
| // 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-navigation',
| |
| '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' )
| |
| );
| |
|
| |
| } );
| |
|
| |
| /**
| |
| $wgHooks['BeforePageDisplay'][] = function( $out, $skin ) {
| |
| $title = Title::newFromText( 'SidebarTree', NS_MEDIAWIKI );
| |
| $page = WikiPage::factory( $title );
| |
| $html = $out->parseAsContent( $page->getContent()->getNativeData() );
| |
| $out->addHTML( "<div id=\"wikitext-sidebar\">$html</div>" );
| |
| return true;
| |
| };
| |
|
| |
| $(document).ready( function() { | | $(document).ready( function() { |
| let tree = $('#wikitext-sidebar'); | | var tree = $('#wikitext-sidebar'); |
| $('#p-logo').after( tree.html() ); | | $('#p-Barre_de_menu_de_gauche').after( tree.html() ); |
| tree.remove(); | | tree.remove(); |
| }); | | }); |
| **/
| |