MediaWiki:Common.js: Difference between revisions

From BetaMC Wiki
Jump to navigation Jump to search
No edit summary
Actually works, lets go!
 
(2 intermediate revisions 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) {
    return function() {
        return mw.loader.getScript(
            mw.util.getUrl('MediaWiki:' + name + '.js', {
                action: 'raw',
                ctype: 'text/javascript'
            })
        );
    };
}


mw.loader.load(
Promise.resolve()
     mw.util.getUrl('MediaWiki:StatsClient.js', {
     .then(script('StatsClient'))
        action: 'raw',
    .then(script('ClamComponent'))
        ctype: 'text/javascript'
;
    })
);
 
mw.loader.load(
    mw.util.getUrl('MediaWiki:ClamComponent.js', {
        action: 'raw',
        ctype: 'text/javascript'
    })
);

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'))
;