User:OneTwoThreeFall/global.js

/*jslint browser, long */ /*global $, mw, playerParams */

window.NoImageLightbox = {novideo: true};

var _scriptsToLoad = [ "I18n-js/code.js", "QDmodal.js", "NoImageLightbox/code.js", "CompareLink.js", //"MarkBlocked.js", "ShowUserGroups.js", "DisplayTimer/code.js", "StickySummary.js", "DedicatedTalkButton.js", "QuickDiff/code.js", //"CacheCheck/code.js", "MassNullEdit/code.js" ].map(function (script) {   return "MediaWiki:" + script; });

mw.loader.load("https://dev.fandom.com/load.php?mode=articles&articles=" + _scriptsToLoad.join("|") + "&only=scripts"); mw.loader.load("https://community.fandom.com/wiki/User:OneTwoThreeFall/LastEdited.js?action=raw&ctype=text/javascript"); //mw.loader.load("https://community.fandom.com/wiki/User:OneTwoThreeFall/AnchoredPatrollback.js?action=raw&ctype=text/javascript");

// bugfix: fix red links not working properly because someone thought it a good idea to obfuscate them for some reason… mw.hook("wikipage.content").add(function ($content) {   $content.find("a[data-uncrawlable-url]").each(function (ignore, element) { element.href = atob(element.dataset.uncrawlableUrl); $(element).off("mousedown"); }); });

// allow fully zooming out at small widths document.head.querySelector("meta[name='viewport']").content = "width=768px, initial-scale=1.0, user-scalable=yes";

// disable redirect links mw.hook("wikipage.content").add(function ($content) {   $content.find(".mw-redirect, .allpagesredirect > a").each(function (ignore, element) { var link = new mw.Uri(element.href); link.extend({redirect: "no"}); element.href = link.toString; }); });

// expand collapsed groups on recent changes/watchlist if ($.inArray(mw.config.get("wgCanonicalSpecialPageName"), ["Recentchanges", "Recentchangeslinked", "Watchlist"]) !== -1) { $(window).load(function {        $(".mw-collapsible-toggle-collapsed").click;    }); }

// don't leave redirect when moving files if (   mw.config.get("wgCanonicalSpecialPageName") === "Movepage" &&    mw.config.get("wgRelevantPageName").indexOf(mw.config.get("wgFormattedNamespaces")[6] + ":") === 0 ) { $("#wpLeaveRedirect").prop("checked", false); }

// don't save page when enter is pressed in summary box - credit to User:Ciencia Al Poder if ($.inArray(mw.config.get("wgAction"), ["edit", "submit"]) !== -1) { $("#wpSummary").keypress(function (event) {       if (event.which === 13) {            return false;        }    }); }

// add clear reason button on delete page if (mw.config.get("wgAction") === "delete") { $("#wpReason").after(" \u232b "); $("#wpClearReason").click(function {        $("#wpReason").val("").focus;    }); }

// add separate list of uncreated categories on Special:Categories if (mw.config.get("wgCanonicalSpecialPageName") === "Categories") { var $newCats = $(" ").css("float", "right").text("Uncreated categories:"); var $newCatsList = $("").appendTo($newCats); $(".mw-spcontent > ul").before($newCats); $(".mw-spcontent > ul > li").has(".newcategory").clone.appendTo($newCatsList); }

// add logs links to tools if (mw.config.get("wgNamespaceNumber") !== -1) { $("#my-tools-menu").prepend(       "Logs for this page"    ); }

// add watchlist and contribs links to oasis user menu $(".wds-global-navigation__user-menu li:nth-child(3)").after(   "My Watchlist" +    "My Contributions" );