MediaWiki:Common.js: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
(function () { | (function () { | ||
// Skip special pages | |||
if (mw.config.get('wgNamespaceNumber') < 0) return; | if (mw.config.get('wgNamespaceNumber') < 0) return; | ||
mw. | var title = mw.config.get('wgPageName'); | ||
var cssPage = 'Template:PageCSS/' + title + '.css'; | |||
var jsPage = 'Template:PageJS/' + title + '.js'; | |||
// Load CSS if present | |||
mw.loader.load( | |||
mw.util.getUrl(cssPage, { action: 'raw', ctype: 'text/css' }), | |||
'text/css' | |||
); | |||
// Load JS if present | |||
mw.loader.load( | |||
mw.util.getUrl(jsPage, { action: 'raw', ctype: 'text/javascript' }), | |||
'text/javascript' | |||
); | |||
})(); | })(); | ||
Revision as of 22:43, 11 March 2026
(function () {
// Skip special pages
if (mw.config.get('wgNamespaceNumber') < 0) return;
var title = mw.config.get('wgPageName');
var cssPage = 'Template:PageCSS/' + title + '.css';
var jsPage = 'Template:PageJS/' + title + '.js';
// Load CSS if present
mw.loader.load(
mw.util.getUrl(cssPage, { action: 'raw', ctype: 'text/css' }),
'text/css'
);
// Load JS if present
mw.loader.load(
mw.util.getUrl(jsPage, { action: 'raw', ctype: 'text/javascript' }),
'text/javascript'
);
})();