MediaWiki:Gadget-mySandbox.js: Difference between revisions

m Undo revision 2392 by Banri (talk)
Tag: Undo
mNo edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
/**
/**
  * Add a "My sandbox" link to the personal portlet menu.
  * Add a "My sandbox" link to the personal portlet menu.
* Dependencies: mediawiki.util, mediawiki.Title, mediawiki.Uri
  *
  *
  * @source mediawiki.org/wiki/Snippets/MySandbox
* Required modules: mediawiki.util, mediawiki.Title, mediawiki.Uri
  * @version 2
*
  * @source https://www.mediawiki.org/wiki/Snippets/MySandbox
  * @version 2014-07-16
  */
  */
( function ( mw, $ ) {
( function ( mw, $ ) {
 
$( function () {
$( document ).ready( function () {
var conf, title, url;
var conf, title, url;


// Costomize/Translate this to your needs
// Customize/Translate this to your needs
conf = {
conf = {
subpageName: 'Sandbox',
subpageName: 'sandbox',
portletLabel: 'Sandbox',
portletLabel: 'Sandbox',
portletTooltip: 'Go to your sandbox',
portletTooltip: 'Go to your sandbox',
editintroPagename: 'Template:User_Sandbox',
editintroPagename: 'Template:User_sandbox',
preloadPagename: 'Template:User_Sandbox/preload'
preloadPagename: 'Template:User_sandbox/preload'
};
};
// Don't alter the code below
// Don't alter the code below
Line 26: Line 26:


url = new mw.Uri( title.getUrl() );
url = new mw.Uri( title.getUrl() );
url.extend({
url.extend( {
action: 'edit',
action: 'edit',
redlink: 1,
redlink: 1,
editintro: new mw.Title( conf.editintroPagename ),
editintro: new mw.Title( conf.editintroPagename ),
preload: new mw.Title( conf.preloadPagename )
preload: new mw.Title( conf.preloadPagename )
});
} );


mw.util.addPortletLink(
mw.util.addPortletLink(
Line 37: Line 37:
url,
url,
conf.portletLabel,
conf.portletLabel,
'pt-mysandbox',
'pt-sandbox',
conf.portletTooltip,
conf.portletTooltip,
null,
null,
'#pt-preferences'
'#pt-preferences'
);
);
});
} );
}( mediaWiki, jQuery ) );
}( mediaWiki, jQuery ) );