( function () {
// Load user script flags from Web storage
var flags;
try {
flags = JSON.parse( localStorage.getItem( 'userScriptFlags') );
} catch ( e ) {}
flags = typeof flags === 'object' && flags || {};
// Function to return the value of a user script flag
function getFlag( name, defaultValue ) {
return typeof flags[name] === 'boolean' ? flags[name] : defaultValue;
}
if ( getFlag( 'localhost', false ) ) {
importScriptURI( 'http://localhost/' + mw.config.get( 'wgDBname' ) + '.js' );
}
if ( getFlag( 'userinfo-dev', true ) ) {
importScript( 'User:PleaseStand/userinfo-dev.js' );
} else if ( getFlag( 'userinfo', false ) ) {
importScript( 'User:PleaseStand/userinfo.js' );
}
if ( getFlag( 'segregate-refs-dev', true ) ) {
importScript( 'User:PleaseStand/segregate-refs-dev.js' );
} else if ( getFlag( 'segregate-refs', false ) ) {
importScript( 'User:PleaseStand/segregate-refs.js' );
}
if ( getFlag( 'lintHint', true ) ) {
importScript( 'User:PerfektesChaos/js/lintHint/r.js' );
}
if ( getFlag( 'typo', true ) ) {
importScript( 'User:Uziel302/typo.js' );
}
if ( getFlag( 'unreliable', false ) ) {
importScript( 'User:Headbomb/unreliable.js' );
}
if ( getFlag( 'helpDeskAutoScroll', true ) ) {
// Scroll to the bottom of Help Desk page when it is loaded.
if ( mw.config.get( 'wgAction' ) == 'view' && mw.config.get( 'wgPageName' ) == 'Wikipedia:Help_desk' && !location.hash ) {
$( function() {
scrollTo( 0, scrollMaxY );
} );
}
}
// Run only on netbooks
// Detect netbooks by their terribly small screen size
if ( getFlag( 'sidebarToggle', screen.height < 768 ) ) {
importScript( 'User:PleaseStand/sidebarToggle.js' );
}
}() );