User:MonkeysHK/common.js

window.ripplesConfig = { normalRipples: document.querySelectorAll('.button:not(.carousel-arrow), .wikia-menu-button') }; importArticles({	type: 'script',	articles: [		// 'u:dev:MediaWiki:Ripple.js',		'u:dev:MediaWiki:ReadProgressBar.js',	] });

// Loads LESS and staff colors updater for administrators mw.loader.using(['mediawiki.api', 'mediawiki.Uri', 'ext.fandom.ContentReview.legacyLoaders.js'], function {    var api = new mw.Api;    var conf = mw.config.get([ "wgUserGroups", "wgPageName", "wgFormattedNamespaces", "wgAction", "wgContentLanguage", ]);   if (!/bureaucrat|sysop|codeeditor|util|staff|helper|global-discussions-moderator|wiki-manager|content-team-member|soap/.test(conf.wgUserGroups.join("\n")))        return;

//###########################################   /* ===Less=== (Y01) */ function getJsonOrEmpty(url, dontLoadForEnglishWiki) { return $.Deferred(function (def) {           if (dontLoadForEnglishWiki && conf.wgContentLanguage === "en")                def.resolve([]);            $.getJSON(url + "?action=raw&ctype=text/json")                .done(function (dt) { def.resolve(dt); })               .fail(function  { def.resolve([]); });       });    }    $.when(        // get list of pages from the English Wiki        getJsonOrEmpty("https://hypixel-skyblock.fandom.com/wiki/MediaWiki:Custom-Less.json", false),        // also enable for pages from local wiki MediaWiki:Custom-Less.json        getJsonOrEmpty(mw.util.getUrl("MediaWiki:Custom-Less.json"), true)    ).then(function (lessJson, lessJsonLocal) {        var lessPages = lessJson.concat(lessJsonLocal);        var mwns = conf.wgFormattedNamespaces[8] + ":"; // localized mw namespace        lessPages = ["Common.css", "Custom-common.less"].concat(lessPages).map(function (s) { return mwns + s;       });        // Display Page Links        if (lessPages.includes(conf.wgPageName)) {            api.get({ action: "query", titles: lessPages.join("|"), prop: "info" }).then(function(data) { if (data.error) return console.warn(data.error); var allPages = Object.keys(data.query.pages).filter(function(k) {                   return Number(k) > 0;                }).map(function(k) {                    return "" + data.query.pages[k] + "";                });                console.log(allPages);                var ul = $("", {                    html: allPages.join("")                });                console.log(ul);                $(".page-header__title-wrapper").append($("", {                    html: ul                }));            }).catch(console.warn);        }    }).catch(console.warn);

});