User:KockaAdmiralac/global.js

window.topLevelCat = 'Browse'; ajaxPages = ["Special:RecentChanges","Special:WikiActivity", "Special:Log", "Special:Log/upload", "Special:Contributions", "Special:NewWikis", "Special:AbuseLog"]; batchDeleteDelay = massCategorizationDelay = massProtectDelay = nullEditDelay = 10; window.AjaxCommentDeleteConfig = { fastDelete: "Deleting comment" };

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:WallGreetingButton/code.js', 'u:dev:MediaWiki:ViewRemoved/code.js', 'u:kocka:MediaWiki:VSTFReport/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', ];

/** * Name:       Global navbar modifications * Author:     KockaAdmiralac <1405223@gmail.com> * Description: Modifies the global navbar to add useful buttons */ $(function {   var username = mw.config.get('wgUserName'),    page = mw.config.get("wgPageName"),    globalLinks = {        "User": "User:" + username,        "Talk": "User_talk:" + username,        "Settings": "Special:Preferences",        "RC": "Special:RecentChanges",        "Admins": "Special:ListAdmins",        "Log off": "Special:UserLogout?returnto=" + page,        "Contribs": "Special:Contributions/" + username,        "Purge": page + "?action=purge",        "QQX": page + "?uselang=qqx",        "Raw": page + "?action=raw"    }, linksContent = "";    if(mw.config.get("wgCityId") === "177") globalLinks.AL = "Special:AbuseLog";    for(var prop in globalLinks) linksContent += "" + prop + "";    $(".global-navigation-container").append(linksContent);    // Empty delete reason    if(mw.config.get('wgAction') && mw.config.get('wgAction') === 'delete') $("#wpReason").val(""); });

/** * Name:       Toggle side bar * Author:     KockaAdmiralac <1405223@gmail.com> * Description: Adds a button for toggling the side bar */ $(function {	$("#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 : []))) }); importArticles({ type: 'style', articles: ["User:Spydar007/highlight.css"] });