User:Eizen/global.js

/** * @class ToolbarLink * @classdesc Obj literal enables addition of custom toolbar links * @author Eizen  */ var ToolbarLink = { conf: mw.config.get([       "wgArticlePath",        "skin"    ]), createToolbarLink: function ($action, $linkAddress, $linkText) { var $href;

if ($action === "construct") { $href = this.conf.wgArticlePath.replace("$1", $linkAddress); } else if ($action === "import") { $href = $linkAddress; }

return mw.html.element("li", {           "class": "overflow",        }, new mw.html.Raw( mw.html.element("a", {               title: $linkText,                href: $href            }, $linkText) ));   },    returnNode: function  { switch (this.conf.skin) { case "oasis": case "wikia": return ".toolbar .tools"; case "monobook": case "wowwiki": case "uncyclopedia": return "#p-tb ul"; }   },    constructLink: function ($linkAddress, $linkText) { var $element = this.createToolbarLink("construct", $linkAddress, $linkText); var $desiredNode = this.returnNode;

jQuery($element).appendTo($desiredNode); },   importScript: function ($script, $linkText) { var $element = this.createToolbarLink("import", "#", $linkText); var $desiredNode = this.returnNode;

jQuery($element).appendTo($desiredNode).click(function {            importScriptPage($script, "dev");            jQuery($element).remove;        }); } };

/** * Assorted window variables */ window.wgWikiaChatWindowFeatures = ""; window.ajaxPages = ["Special:WikiActivity", "Special:RecentChanges"]; window.pageCreatorTimestamp = true; 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] } };

/** * General purpose imports to all wikis */ importArticles({   type: "script",    articles: [        "u:dev:AjaxRC/code.js",        "u:dev:BlogLink/code.js",        "u:dev:TallyLink/code.js",        "u:dev:DisableCode/code.js",        "u:dev:PortableCSSPad/code.js",        "u:dev:CodeQuickLinks/code.js",        "u:dev:NullEditButton/code.js",        "u:dev:UserActivityTab/code.js",        "u:dev:SkinSwitchButton/code.js",        "u:dev:MediaWikiBacklink/code.js",        "u:dev:Thread Inspection/code.js"    ] });

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

/** * 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": ToolbarLink.constructLink("Template:User:Eizen?action=edit", "Template"); ToolbarLink.constructLink("User:Eizen/global.js?action=edit", "GlobalJS"); ToolbarLink.constructLink("User:Eizen/global.css?action=edit", "GlobalCSS"); ToolbarLink.importScript("EditBio/code.js", "EditBio"); break; case "1619339": importArticles({       type: "script",        articles: [            "u:dev:UTCClock/code.js"        ]    }); ToolbarLink.constructLink("Special:WikiActivity", "S:WA"); break; }