MediaWiki:Gadget-widgetPreload.js

From Moegirlpedia
Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* <pre> */
/**
 * -------------------------------------------------------------------------
 * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
 * -------------------------------------------------------------------------
 */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/widgetPreload/MediaWiki:Gadget-widgetPreload.js|user=[[U:AnnAngela]]|longId=3ea858d1abfa9a00e93328836c9754ba6a8033e6|shortId=3ea858d|message=chore(widgetPreload): Rename to correct one}}';

"use strict";
$(function () {
    var toUpperFirstCase = function (t) { return "".concat("".concat(t[0]).substring(0, 1).toUpperCase()).concat("".concat(t).substring(1)); };
    if (mw.config.get("wgNamespaceNumber") === 274 && !mw.config.get("wgCurRevisionId")) {
        if (mw.config.get("wgAction") === "edit") {
            var regex = /[-_,./\\]/;
            if (regex.test(mw.config.get("wgPageName"))) {
                window.onbeforeunload = undefined;
                $(window).off("beforeunload");
                location.replace("".concat(mw.config.get("wgServer")).concat(mw.config.get("wgScriptPath"), "/index.php?action=edit&title=").concat(mw.config.get("wgPageName").replace(/ |_/g, "").replace(/^([^/]*)[/\\].*$/i, "$1").split(regex).map(function (n) {
                    return toUpperFirstCase(n);
                }).join("")));
                return;
            }
            var flag = "wg".concat(mw.config.get("wgTitle")).replace(/ /g, "");
            $("#wpTextbox1").val("<noinclude> </noinclude><includeonly><!--{if !isset($".concat(flag, ") || !$").concat(flag, "}--><!--{assign var=\"").concat(flag, "\" value=true scope=\"global\"}--><script>\n\"use strict\";\nwindow.RLQ = window.RLQ || [];\nwindow.RLQ.push(() => {\n\n});\n</script><!--{/if}--></includeonly>"));
        }
        if ($("#mw-content-text > .mw-parser-output > .noarticletext")[0]) {
            $(document.body).addClass("noWidget");
        }
    }
});

/* </pre> */