MediaWiki:Gadget-mySandbox.js: Difference between revisions
mNo edit summary |
mNo edit summary |
||
| Line 1: | Line 1: | ||
/** | /** | ||
* Add a "My sandbox" link to the personal portlet menu. | * Add a "My sandbox" link to the personal portlet menu. | ||
* | * | ||
* @source mediawiki.org/wiki/Snippets/MySandbox | * Required modules: mediawiki.util, mediawiki.Title, mediawiki.Uri | ||
* @version | * | ||
* @source https://www.mediawiki.org/wiki/Snippets/MySandbox | |||
* @version 2014-07-16 | |||
*/ | */ | ||
( function ( mw, $ ) { | ( function ( mw, $ ) { | ||
$( function () { | |||
$ | |||
var conf, title, url; | var conf, title, url; | ||
// | // 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' | |||
}; | }; | ||
// Don't alter the code below | // Don't alter the code below | ||
| Line 25: | 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 36: | Line 37: | ||
url, | url, | ||
conf.portletLabel, | conf.portletLabel, | ||
'pt- | 'pt-sandbox', | ||
conf.portletTooltip, | conf.portletTooltip, | ||
null, | null, | ||
'#pt-preferences' | '#pt-preferences' | ||
); | ); | ||
}); | } ); | ||
}( mediaWiki, jQuery ) ); | }( mediaWiki, jQuery ) ); | ||