User:PAC2/Rock your side box.js

Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
/*
La documentation de ce script se trouve ici User:PAC2/Rock_your_side_box
*/

mw.loader.using('mediawiki.util', function () {

var nav = function ($) {

     mw.util.addPortletLink(
       portletID = 'p-navigation', 
       href = 'https://tools.wmflabs.org/hay/sdsearch/', 
       text = 'Structured search', 
       id = 'p-structuredsearch', 
       tooltip = 'Structured search') ;
       
};
$(document).ready(nav);

$("#p-pagemisc").append("<div id='p-mediabox' class='mw-portlet' role='navigation', aria-labelledby='p-mediabox-label'><h3 id='p-mediabox-label'>Media box</h3><div class='body'><ul></ul></div></div>") ;

if (mw.config.get('wgNamespaceNumber') == 6) {

var mediabox = function ($) {
	
	   mw.util.addPortletLink(
       portletID = 'p-mediabox', 
       href = 'https://wd-image-positions.toolforge.org/file/' + mw.config.get( 'wgPageName' ), 
       text = 'Image position', 
       id = 'p-imagepositions2', 
       tooltip = 'Annotate images') ;
	};
	$(document).ready(mediabox);
}

});