MediaWiki:Common.js

/** * Load withJS and withCSS * * @source: http://www.mediawiki.org/wiki/Snippets/Load_withJS_and_withCSS * @rev: 1 * @author: Krinkle */ /* withJS */ mw.loader.using( 'mediawiki.util', function {

var extraJS = mw.util.getParamValue( 'withJS' ); if ( extraJS ) { // Disallow some characters in file name if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) { importScript( extraJS ); // Dont use alert but the jsMsg system. Run jsMsg only once the DOM is ready. } else { $(document).ready( function {     jsMsg( extraJS + ' script not allowed to be loaded.', 'error' );    } ); } } /* withCSS */ var extraCSS = mw.util.getParamValue( 'withCSS' ); if ( extraCSS ) { // Disallow some characters in file name if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) { importStylesheet( extraCSS ); // Dont use alert but the jsMsg system. Run jsMsg only once the DOM is ready. } else { $(document).ready( function {     jsMsg( extraCSS + ' stylesheet not allowed to be loaded.', 'error' );    } ); } }

} );