User:Eizen/global.js

/** * @file Unless otherwise stated, the snippets on this page were written by me. * Feel free to use/modify them as desired, provided proper attribution is * included. */

/** * Assorted window variables */ window.pageCreatorTimestamp = true; window.ajaxPages = [ "Special:WikiActivity", "Special:RecentChanges", "Special:Log" ]; window.lastEdited = { avatar: false, size: false, comment: false, namespaces: { include: [0, 4, 8, 10, 14], exclude: [1, 2, 3, 5, 6, 7, 9, 11, 12, 15, 110, 111, 828, 829, 1202] } }; window.NavLinksConfig = { title: "QuickLinks", placement: "global", links: [ {           text: "Eizen", address: "w:c:eizen:Special:WikiActivity" },       {            text: "Dev", address: "w:c:dev:Special:WikiActivity" },       {            text: "API", address: "w:c:api:Special:WikiActivity" },       {            text: "Diep.io", address: "w:c:diepio:Special:WikiActivity" },       {            text: "SWFanon", address: "w:c:swfanon:Special:WikiActivity" },       {            text: "Global.js", address: "w:User:Eizen/global.js" },       {            text: "Global.css", address: "w:User:Eizen/global.css" }   ] };

/** * Forbid double loading of Contribs option via BlogLink and ContribsLink */ if (mw.config.get("wgCityId") === "1399015") { var $interval = setInterval(function {        if (window.isBlogLinkLoaded && jQuery("#bl-contributions").exists) {            clearInterval($interval);            jQuery("#bl-contributions").css("display", "none");        }    }, 200); }

/** * Replaces the "Random page" dropdown item with a link to RecentChanges */ if (   jQuery.inArray(mw.config.get("skin"), ["oasis", "wikia"]) !== -1 &&    !jQuery("a[data-tracking='explore-changes']").exists ) { mw.loader.using("mediawiki.util", function {        jQuery("a[data-tracking='explore-random']")            .attr("href", mw.util.getUrl("Special:RecentChanges"))            .attr("data-tracking", "explore-changes")            .text("Recent Changes");    }); }

/** * Hide standard Oasis toolbar items */ if (jQuery.inArray(mw.config.get("skin"), ["oasis", "wikia"]) !== -1) { [       "a[data-tracking='admindashboard/toolbar/admin']", ".tools-customize", ".global-shortcuts-help-entry-point", "#ca-unwatch" ].forEach(function ($item) {       jQuery($item).closest("li").remove;    }); }

/** * Bypass Special:InfoboxBuilder * Modified from code by User:Ursuul */ if (mw.config.get("wgCanonicalSpecialPageName") === "InfoboxBuilder") { var $pageName = "Template:" + mw.config.get("wgPageName").split("/")[1] + "?action=edit&useeditor=source"; window.location.href = mw.config.get("wgArticlePath").replace("$1", $pageName); }

/** * Stripped down version of User:OneTwoThreeFall's GlobalChatJS */ if (window.ChatWidget && ChatWidget.onClickChatButton) { ChatWidget.onClickChatButton = function ($chatLink) { var $chatUrl = $chatLink && new mw.Uri($chatLink); var $chatWindow = window.open($chatUrl.toString, "wikiachat", "");

$chatWindow.addEventListener("DOMContentLoaded", function {            $chatWindow.importArticles({ type: "script", articles: [ "u:dev:ChatAwayButton/code.js", "u:dev:ChatUserPageButton.js", "u:dev:NewMessageCount.js", "u:dev:PrivateMessageAlert/code.js", "u:eizen:User:Eizen/UnbindEnterKey.javascript" ]           });        }, false); }; }

/** * General purpose imports to all wikis */ importArticles({   type: "script",    articles: [        "u:dev:AjaxRC/code.js",        "u:dev:AjaxUndo/code.js",        "u:dev:CodeQuickLinks/code.js",        "u:dev:ConsistentModules/code.js",        "u:dev:DisableCode/code.js",        "u:dev:NavLinks/code.js",        "u:dev:NullEditButton/code.js",        "u:dev:PortableCSSPad/code.js",        "u:dev:RevealAnonIP/usercode.js",        "u:dev:Rollback/code.2.js",        "u:dev:SkinSwitchButton/code.js",        "u:dev:Thread Inspection/code.js",        "u:dev:ToolbarLinks/code.js",        "u:dev:WorkingMoreUsersCount.js",        "u:eizen:User:Eizen/AnonLookup.javascript",        "u:eizen:User:Eizen/BotEdit.javascript",        "u:eizen:User:Eizen/ContribsLink.javascript",        "u:eizen:User:Eizen/CreateUserPage.javascript",        "u:eizen:User:Eizen/PurgeEditTally.javascript"    ] });

/** * Ensures that TallyLink only loads once a tally refresh has occurred * via PurgeEditTally.js */ mw.hook("refreshedMasthead").add(function {    importScriptPage("TallyLink/code.js", "dev"); });

/** * User page-related scripts */ if (   jQuery("#UserProfileMasthead").exists &&    jQuery(".UserProfileMasthead .masthead-info h1").text !== "Eizen" &&    mw.config.get("wgSitename") !== "Eizen" ) { importArticles({       type: "script",        articles: [            "u:dev:UnhideUserMasthead/code.js",            "u:dev:UserAccountAge/beta.js"        ]    }); }

/** * Page-specific imports */ if (mw.config.get("wgCityId") === "1619339" && mw.config.get("wgArticleId") === 98) { window.customToolbarLinks = [ {           action: "link", address: "MediaWiki:Common.css?action=edit", title: "Common" }   ]; }

/** * Wiki-specific imports */ switch (mw.config.get("wgCityId")) { case "644": importArticles({       type: "script",        articles: [            "u:dev:LastEdited/code.js",            "u:dev:PageCreator/code2.js"        ]    }); break; case "177": window.customToolbarLinks = [ {           action: "link", address: "User:Eizen/global.js?action=edit", title: "Global JS" },       {            action: "link", address: "User:Eizen/global.css?action=edit", title: "Global CSS" },       {            action: "link", address: "Template:User:Eizen?action=edit", title: "Edit Base Template" },       {            action: "link", address: "Template:User:Eizen/active?action=edit", title: "Edit Active Template" },       {            action: "import", script: "EditBio/code.js", title: "EditBio" }   ];    break; }