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] } };

/** * 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 list items without actual ids or class names */ 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", "#ca-ve-edit" ].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:ChatBlockButton/code.3.js", "u:dev:ChatMessageWallCount.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: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 */ if (mw.config.get("wgNamespaceNumber") === 2) { mw.hook("refreshedMasthead").add(function {        importScriptPage("TallyLink/code.js", "dev");    }); } else { 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 Template" },       {            action: "import", script: "EditBio/code.js", title: "EditBio" }   ];    break; }