User:KockaAdmiralac/global.js

window.topLevelCat = 'Browse'; ajaxPages = ["Special:RecentChanges", "Special:WikiActivity", "Special:Log", "Special:Log/upload", "Special:Newwikis", "Special:AbuseLog"]; batchDeleteDelay = massCategorizationDelay = massProtectDelay = nullEditDelay = 10; window.AjaxCommentDeleteConfig = { fastDelete: "Deleting comment" }; window.ImageNotificationConfig = { refreshInterval: 1000000, enableOn: ["Special:BlankPage/Images"] };

var regularList = [ 'u:dev:MediaWiki:AjaxRC/code.js', 'u:dev:MediaWiki:CacheCheck/code.js', 'u:dev:MediaWiki:AjaxUndo/code.js', 'u:dev:MediaWiki:Rollback/code.js', 'u:dev:MediaWiki:WallGreetingButton/code.js', 'u:dev:MediaWiki:QuickDiff/code.js', 'u:dev:MediaWiki:QuickLogs/code.js', 'u:kocka:MediaWiki:VSTFReport/code.js', 'u:kocka:MediaWiki:ImageNotification/code.js' ], adminList = [ 'u:dev:MediaWiki:WHAM/code.2.js', 'u:dev:MediaWiki:MassCategorization/code.js', 'u:dev:MediaWiki:MassProtect/code.js', 'u:dev:MediaWiki:MassNullEdit/code.js', 'u:dev:MediaWiki:AjaxPatrol/code.js', 'u:dev:MediaWiki:AjaxBatchDelete/code.2.js', 'u:kocka:MediaWiki:AjaxCommentDelete/code.js', 'u:kocka:MediaWiki:AjaxThreadDelete/code.js' ];

$(function {   // Wide-mode codeeditor    if($(".codeeditor").length > 0) var wideModeCodeeditor = setInterval(function {       if($(".codeeditor .editpage-widemode-trigger").length > 0) {           clearInterval(wideModeCodeeditor); $(".codeeditor .editpage-widemode-trigger").click; }   }, 100);    // Always view removed replies    $(".message-removed.hide").removeClass("hide");    // Empty delete reason    if(mw.config.get('wgAction') && mw.config.get('wgAction') === 'delete') $("#wpReason").val("");    /**     * Name:        Global navbar modifications     * Author:      KockaAdmiralac <1405223@gmail.com>     * Description: Modifies the global navbar to add useful buttons     */    var page = mw.config.get("wgPageName"),    globalLinks = {        "User": "Special:Mypage",        "Talk": "Special:Mytalk",        "Settings": "Special:Preferences",        "RC": "Special:RecentChanges",        "Admins": "Special:ListAdmins",        "Log off": "Special:UserLogout?returnto=" + page,        "Contribs": "Special:Mycontribs",        "Purge": page + "?action=purge",        "QQX": page + "?uselang=qqx",        "Raw": page + "?action=raw"    }, linksContent = "";    if(mw.config.get("wgCityId") === "177") {       globalLinks = $.extend({            "AL": "Special:AbuseLog",            "Images": "Special:BlankPage/Images",            "Global JS": "Special:Mypage/global.js",            "Global CSS": "Special:Mypage/global.css"        }, globalLinks); }   for(var prop in globalLinks) linksContent += "" + prop + ""; $(".global-navigation-container").append(linksContent); /**    * Name:        Toggle side bar * Author:     KockaAdmiralac <1405223@gmail.com> * Des cription: Adds a button for toggling the side bar */   $("#WikiHeader .buttons").append('Toggle side bar '); $("#ToggleSideBarButton").click(function	{		if($("#WikiaRail").css("display") === "block") 		{			$("#WikiaMainContent").css({width: "100%"});			$("#WikiaRail").css({display: "none"});		}		else		{			$("#WikiaMainContent").css({width: "calc(100% - 320px)"});			$("#WikiaRail").css({display: "block"});		}	}); });

/** * Name:       Global edit count script * Author:     Noreplyz *             KockaAdmiralac <1405223@gmail.com> (smaller modifications) * Description: Adds a global edit count to user's masthead. */

var mwApiCounter1291238 = setInterval(function {   if(typeof mw.Api !== 'undefined')    {        if ($("#UserProfileMasthead").length === 0) return;        else        {            var username = $("h1").text;            new mw.Api.get({ action: "query", list: "users", ususers: username, usprop: "editcount" }).done(function(data) {               if(data.error) new BannerNotification("Error while fetching user edit count: " + data.error.code, 'error').show; else if(typeof data.query.users[0].editcount !== 'undefined') $(' ' + data.query.users[0].editcount.toString.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,") + ' global edits ').insertAfter(".tally"); }).fail(function{ new BannerNotification("Error while fetching user edit count", 'error').show; });       }        clearInterval(mwApiCounter1291238);    } }, 100);

importArticles({ type: 'script', articles: (regularList.concat((wgUserGroups.includes("sysop") ? adminList : []))) });