User:Withersoul 235/global.js

// AjaxRC Configuration window.ajaxSpecialPages = ["Recentchanges", "WikiActivity", "Watchlist", "Log", "Contributions"]; window.ajaxRefresh = 30000; window.AjaxRCRefreshText = 'Auto-refresh'; window.AjaxRCRefreshHoverText = 'Automatically refresh the page'; window.ajaxIndicator = 'https://vignette.wikia.nocookie.net/dev/images/b/ba/Snake_throbber_dark-bg.gif/revision/latest?cb=20140519203615';

// Imports

importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:AddFileToArticle/code.js',        'u:dev:MediaWiki:AjaxRC/code.js',        'u:dev:MediaWiki:BlogLink/code.js',        'u:dev:MediaWiki:DiscussionsFeed.js',        'u:dev:MediaWiki:DiscussionsRailModule/code.js',        'u:dev:MediaWiki:DedicatedTalkButton.js',        'u:dev:MediaWiki:EditBio/code.js',        'u:dev:MediaWiki:GlobalEditcount/code.js',        'u:dev:LastEdited/code.js',        'u:dev:LightBlock/code.js',        'u:dev:MediaWiki:NewImages.js',        'u:dev:MediaWiki:NotesModule/code.js',        "u:dev:PageCreator/code2.js",        'u:dev:MediaWiki:PageMakerPro/code.js',        'u:dev:MediaWiki:PiniginsUserInfo/code.js',        'u:dev:PortableCSSPad/code.js',        'u:dev:Quick_Management/code.js',        "u:dev:MediaWiki:QuickModTools/loader.js",        'u:dev:MediaWiki:RailWAM/code.js',        'u:dev:RecentChangesModule/code.js', 'u:dev:MediaWiki:ReplyList/code.js', 'u:dev:MediaWiki:OldFilePages/code.js', 'u:dev:MediaWiki:SearchJS/code.js', 'u:dev:MediaWiki:ShowUserGroups.js', 'u:dev:MediaWiki:SpellCheckModule/code.js', 'u:dev:MediaWiki:UnhideUserMasthead/code.js', "u:dev:UserActivityTab/code.js", "u:dev:UsernameAvailability/code.js", 'u:dev:MediaWiki:VSTFReport.js' ] });

importScriptPage('MediaWiki:CapsFirst/code.js', 'dev'); importScriptPage('MediaWiki:Translator/Translator.js', 'dev');

// Make Visual Editor links load the regular editor instead

if ($.getUrlVar('veaction') == 'edit') location.replace(document.URL.replace('veaction','action')); /* Reveals a user's personal JS / CSS on their masthead */ // Shows global codes on Community Central

if (mw.config.get('wgCityId') === '177') { (function {   var $header = $('#WikiaUserPagesHeader');    if ($header.exists) {        var title = 'User:' + $header.find('#UserProfileMasthead h1').text + '/global.js';        $header.find('.tabs-container .tabs').append( $('', { 'data-id': 'global.js' }).append(               $('', { href: mw.util.getUrl(title), title: title, text: 'Global JS' })           )        );    } });

(function {   var $header = $('#WikiaUserPagesHeader');    if ($header.exists) {        var title = 'User:' + $header.find('#UserProfileMasthead h1').text + '/global.css';        $header.find('.tabs-container .tabs').append( $('', { 'data-id': 'global.js' }).append(               $('', { href: mw.util.getUrl(title), title: title, text: 'Global CSS' })           )        );    } }); } else { // Shows wiki-specific JS / CSS on all other wikis (function {   var $header = $('#WikiaUserPagesHeader');    if ($header.exists) {        var title = 'User:' + $header.find('#UserProfileMasthead h1').text + '/common.js';        $header.find('.tabs-container .tabs').append( $('', { 'data-id': 'common.js' }).append(               $('', { href: mw.util.getUrl(title), title: title, text: 'JS' })           )        );    } });

(function {   var $header = $('#WikiaUserPagesHeader');    if ($header.exists) {        var title = 'User:' + $header.find('#UserProfileMasthead h1').text + '/common.css';        $header.find('.tabs-container .tabs').append( $('', { 'data-id': 'common.css' }).append(               $('', { href: mw.util.getUrl(title), title: title, text: 'CSS' })           )        );    } });

(function {   var $header = $('#WikiaUserPagesHeader');    if ($header.exists) {        var title = 'User:' + $header.find('#UserProfileMasthead h1').text + '/wikia.js';        $header.find('.tabs-container .tabs').append( $('', { 'data-id': 'wikia.js' }).append(               $('', { href: mw.util.getUrl(title), title: title, text: 'Wikia JS' })           )        );    } });

(function {   var $header = $('#WikiaUserPagesHeader');    if ($header.exists) {        var title = 'User:' + $header.find('#UserProfileMasthead h1').text + '/wikia.css';        $header.find('.tabs-container .tabs').append( $('', { 'data-id': 'wikia.css' }).append(               $('', { href: mw.util.getUrl(title), title: title, text: 'Wikia CSS' })           )        );    } }); }

// Shows User Activity tab regardless of who the user is (currently not working; to be fixed)

require(["mw", "wikia.window"], function (mw, wk) {   "use strict";    if ( window.isUserActivityTabLoaded || jQuery("li[data-id='user-activity']").exists ) {       return;    }    window.isUserActivityTabLoaded = true;    /**     * @class UserActivityTab     * @classdesc main class     */    var UserActivityTab = {        /*         * From https://github.com/Wikia/app/blob/dev/         * extensions/wikia/UserActivity/UserActivity.i18n.php         * Thx Cube          */        i18n: {            "de": "Benutzeraktivität",            "be": "Актыўнасць удзельніка",            "en": "User Activity",            "es": "Actividad del usuario",            "fr": "Votre activité",            "hi": "उपयोगकर्ता गतिविधि",            "it": "Attività dell\"utente",            "ja": "アクティビティ",            "kn": "ಬಳಕೆದಾರರ ಚಟುವಟಿಕೆ",            "pl": "Aktywność użytkownika",            "pt": "Atividade",            "ru": "Активность участника",            "sr": "Корисничка активност",            "sr-el": "Korisnička aktivnost", "sv": "Användaraktivitet", "uk": "Активність користувача", "zh": "用户活动", "zh-hant": "用户活動" },       /**         * @method constructItem * @description Method returns a link inside a list item * @param {string} $href * @param {string} $text * @returns {mw.html.element} */       constructItem: function ($href, $text) { return mw.html.element("li", {               "id": "useractivitytab-li",                "data-id": "user-activity"            }, new mw.html.Raw( mw.html.element("a", {                   "id": "useractivitytab-a",                    "href": $href,                    "title": $text                }, $text) ));       },        /**         * @method returnSkinContent * @description Method returns the name of the user page owner and the *             element after which to append the list item. Array *             content is skin-specific. * @returns {array} $skinSpecificContent */       returnSkinContent: function  { var $skinSpecificContent = []; switch (wk.skin) { case "oasis": case "wikia": $skinSpecificContent.push(                   jQuery(".UserProfileMasthead .masthead-info h1").text,                    ".WikiaUserPagesHeader ul.tabs"                ); break; case "monobook": case "wowwiki": case "uncyclopedia": $skinSpecificContent.push(                   jQuery(".firstHeading, #firstHeading")                        .clone.children.remove.end.text.split(":")[1],                    "#p-cactions ul"                ); break; }           return $skinSpecificContent; },       /**         * @method init * @description Assembles all the necessary content. * @returns {void} */       init: function  { var $lang = this.i18n[wk.wgUserLanguage] || this.i18n[wk.wgUserLanguage.split("-")[0]] || this.i18n.en; var $href = "//c" + wk.wgCookieDomain + wk.wgArticlePath.replace("$1", "Special:UserActivity"); var $skinContent = this.returnSkinContent; var $element = this.constructItem($href, $lang); }       };    });    jQuery(document).ready(jQuery.proxy(UserActivityTab.init, UserActivityTab)); (end); // Personalized version of RestoreContribsButton.

/* Temporarily not in use. $(function {   $('.wds-community-header__wiki-buttons').remove; var config = mw.config.get([ 'wgPageName' ]);   $('.wds-community-header__top-container').append( '' + ' ' + ' '+ '<path d="M4.667 11H8v1.333H4.667V11zm0-3.333h8V9h-8V7.667zm0-3.334h8v1.334h-8V4.333zM2.667 17H10v-4.667c0-.368.3-.666.667-.666h4.666v-10A.667.667 0 0 0 14.667 1h-12A.667.667 0 0 0 2 1.667v14.666c0 .368.3.667.667.667z"/><path d="M14.943 13h-3.61v3.61z"/></g> ' + ' Contribute <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" class="wds-icon wds-icon-tiny wds-dropdown__toggle-chevron" id="wds-icons-dropdown-tiny"><path d="M6 9l4-5H2" fill-rule="evenodd"> ' + '<div class="wds-is-not-scrollable wds-dropdown__content">' + '<ul class="wds-list wds-is-linked">' + '<li><a href="/wiki/' + config.wgPageName + '?action=edit">Edit this page</a></li>' + '<li><a href="/wiki/Special:CreatePage">Add a Page</a></li>' + '<li><a href="/wiki/Special:WikiaVideoAdd">Add an Video</a></li>' + '<li><a href="/wiki/Special:Upload">Add an Image</a></li>' + '<li><a href="/wiki/Special:WikiActivity">Wiki Activity</a></li>' + '<li><a href="/wiki/Special:AdminDashboard" class="sysop-only">Admin Dashboard</a></li>' + '<li><a href="/wiki/MediaWiki:Common.css?action=edit" class="sysop-only">Edit wiki CSS</a></li>' + '<li><a href="/wiki/MediaWiki:Common.js?action=edit" class="sysop-only">Edit wiki JS</a></li>' + '<li><a href="/wiki/MediaWiki:Wikia.js?action=edit" class="sysop-only">Edit Oasis-only JS</a></li>' + '<li><a href="/wiki/MediaWiki:ImportJS?action=edit" class="sysop-only">Import JS addons</a></li>' + '<li><a href="/wiki/MediaWiki:Wiki-navigation?action=edit" class="sysop-only">Edit wiki navigation</a></li>' + '<li><a href="/wiki/' + config.wgPageName + '?action=purge">Reload page</a></li>' + '<li><a href="/wiki/' + config.wgPageName + '?action=watch">Add page to watchlist</a></li>' + '<li><a href="/wiki/' + config.wgPageName + '?action=unwatch">Remove page from watchlist</a></li>' + '</ul>  ');    if(wgUserGroups.indexOf('sysop') > -1 || wgUserGroups.indexOf('staff') > -1 || wgUserGroups.indexOf('helper') > -1) {        return 0;    } else {        $('a.sysop-only').remove;    } });