Actions

MediaWiki

Common.js: Difference between revisions

From Anthrodia Atlas

dev>MirahezeGDPR a51581232c7cc84ec1a32c40d8489548
Created page with "→Any JavaScript here will be loaded for all users on every page load.: var extraCSS = mw.util.getParamValue( 'withCSS' ), extraJS = mw.util.getParamValue( 'withJS' ); if ( extraCSS ) { if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) { mw.loader.load( '/w/index.php?title=' + extraCSS + '&action=raw&ctype=text/css', 'text/css' ); } else { mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } ); } }..."
 
m 8 revisions imported
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
var extraCSS = mw.util.getParamValue( 'withCSS' ),
// Username script //
extraJS = mw.util.getParamValue( 'withJS' );


if ( extraCSS ) {
(function () {  
if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) {
mw.loader.load( '/w/index.php?title=' + extraCSS + '&action=raw&ctype=text/css', 'text/css' );
} else {
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } );
}
}


if ( extraJS ) {
if (mw.config.get('wgUserName') !== null) $('span.insertusername').text(mw.config.get('wgUserName'));
if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) {
mw.loader.load( '/w/index.php?title=' + extraJS + '&action=raw&ctype=text/javascript' );
})();
} else {
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } );
}
}
// from enwiki common.js

Latest revision as of 04:09, 27 May 2026

/* Any JavaScript here will be loaded for all users on every page load. */
// Username script // 

(function () { 

if (mw.config.get('wgUserName') !== null) $('span.insertusername').text(mw.config.get('wgUserName'));
	 
})();