MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
RobertWesner (talk | contribs) No edit summary |
RobertWesner (talk | contribs) Actually works, lets go! |
||
| (One intermediate revision by the same user not shown) | |||
| Line 2: | Line 2: | ||
// needs to be loaded from separate JS files, because the shitty outdated JS-parser in mediawiki refuses any modern syntax lol | // needs to be loaded from separate JS files, because the shitty outdated JS-parser in mediawiki refuses any modern syntax lol | ||
var args = { action: 'raw', ctype: 'text/javascript' }; | |||
function script(name) { | |||
function | return function() { | ||
return | return mw.loader.getScript( | ||
mw.util.getUrl('MediaWiki:' + name + '.js', { | |||
action: 'raw', | action: 'raw', | ||
ctype: 'text/javascript' | ctype: 'text/javascript' | ||
}) | }) | ||
); | |||
}; | |||
} | |||
Promise.resolve() | |||
.then(script('StatsClient')) | |||
.then(script('ClamComponent')) | |||
; | |||
Latest revision as of 11:28, 8 October 2026
/* Any JavaScript here will be loaded for all users on every page load. */
// needs to be loaded from separate JS files, because the shitty outdated JS-parser in mediawiki refuses any modern syntax lol
var args = { action: 'raw', ctype: 'text/javascript' };
function script(name) {
return function() {
return mw.loader.getScript(
mw.util.getUrl('MediaWiki:' + name + '.js', {
action: 'raw',
ctype: 'text/javascript'
})
);
};
}
Promise.resolve()
.then(script('StatsClient'))
.then(script('ClamComponent'))
;