User:Inductiveload/common.js

const load = true;

function setUpEnableToggle { const enabled = mw.storage.get( 'userjs.commonjs.enable' ) === '1';

const toggleLink = mw.util.addPortletLink(		'p-tb',		'#',		( enabled ? 'Disable' : 'Enable' ) + ' common.js',		'n-enableCommonJs',		'Enable/disable user common.js'	);

toggleLink.onclick = function { mw.storage.set( 'userjs.commonjs.enable', enabled ? '0' : '1' ); location.reload; };	return enabled; }

mw.loader.using( 'mediawiki.storage', function {	const enabled = setUpEnableToggle;	if ( load && enabled ) {		// Load local dev script if available, or fall back to an on-wiki version		mw.loader.getScript('https://localhost:5555/wiktionary/common.js');	} } );