User:Mainframe98/common.js

/** */ ( function ( mw, $ ) {
 * Adds a Sandbox button, originally from https://www.wikidata.org/wiki/MediaWiki:Gadget-mySandbox.js, but that version used a localized subpagename.
 * Tweaked to remove redundancy

$( document ).ready( function {        var conf, title, url;        var lang = mw.user.options.get( 'language' );

var transconf = { 'en': { portletLabel: 'Sandbox', portletTooltip: 'Go to your sandbox', },           'nl': { portletLabel: 'Zandbak', portletTooltip: 'Ga naar je zandbak', }       };        if ( transconf [ lang ] ) { conf = transconf[ lang ]; } else { conf = transconf[ 'en' ]; }       title = new mw.Title( 'Special:MyPage/Sandbox' );

url = new mw.Uri( title.getUrl );

mw.util.addPortletLink(           'p-personal',            url,            conf.portletLabel,            'pt-mysandbox',            conf.portletTooltip,            null,            '#pt-preferences'        ); }); }( mediaWiki, jQuery ) );