User:MonkeysHK/common.js

$(function {   var loadScripts = [        { script: { ns: 8, name: "Gadget-TooltipsEditor.js" }, pages: [{ns: 828, name: "Inventory slot/Tooltips"}] },        { script: { ns: 8, name: "Gadget-PagewiseLoader/Bingo.js" }, pages: [ "Bingo/Events" ] },    ];    var conf = mw.config.get([ "wgPageName", "wgFormattedNamespaces" ]);   var importList = [];    function resolvePagename(pg) {        var name;        if (typeof pg !== "string" && pg.ns)            name = (conf.wgFormattedNamespaces[pg.ns] || "") + ":" + pg.name;        else            name = pg;        return name.replaceAll(" ", "_");    }    for (var index in loadScripts) {        var allowedPages = loadScripts[index].pages.map(resolvePagename);        if (!allowedPages.includes(conf.wgPageName))            continue;        importList.push(resolvePagename(loadScripts[index].script));    }    if (importList.length > 0)        importArticles({ type: "script", articles: importList }); });