User:King Dragonhoff/global.js

// Dev Wiki Imports AjaxDiff = { expiry: "6 months", reason: "Vandalism" }; QuickThreads = { message: "Inappropriate", 'notify-admin': false }; QuickCommentsdeletereason = "Spam"; QuickCommentsreason = "Inappropriate behavior"; QuickCommentsduration = "2 weeks"; nullEditDelay = 500; massProtectDelay = 500; massCategorizationDelay = 500; importArticles({   type: 'script',    articles: [        'u:dev:AjaxDiff/code.js',        'u:dev:PurgeButton/code.js',        'u:dev:QuickThreads/code.js',        'u:dev:QuickComments/code.js',        'u:dev:MediaWiki:WHAM/code.2.js',        'u:dev:MassNullEdit/code.js',        'u:dev:MediaWiki:MassProtect/code.js',        'u:dev:MediaWiki:MassCategorization/code.js'    ] });

// Change user links on Recent Activity to go to Contributions (function {   function activityUserLinks {        $('.activityfeed .subtle > a, .activityfeed .wallfeed a.real-name').each(function  { var username = decodeURIComponent($(this).attr('href').split(':').pop); $(this).attr('href', mw.util.getUrl('Special:Contributions/' + username)); });   }    var activityEntries = document.querySelectorAll(".activityfeed > li").length;    $('.activity-feed-more').click(function { var userLinksInterval = setInterval(function {           if (document.querySelectorAll(".activityfeed > li").length > activityEntries) {                activityEntries = document.querySelectorAll(".activityfeed > li").length;                activityUserLinks;                clearInterval(userLinksInterval);            }        }, 1000); });   activityUserLinks; });

// Random Thread Reply Picker Button (function {   if (document.querySelector("#Wall.Thread")) {        var toolbar = document.getElementById("WikiaBar").querySelector("ul.tools");        var toolbarButtonsCount = toolbar.querySelectorAll("ul.tools > li").length;        var rollButton = document.createElement("a");        rollButton.setAttribute("role", "button");        rollButton.style.cursor = "pointer";        rollButton.title = "Choose a random reply to this thread.";        rollButton.appendChild(document.createTextNode("Random Reply"));        var rollButtonLi = document.createElement("li");        rollButtonLi.appendChild(rollButton);        toolbar.insertBefore(rollButtonLi, toolbar.childNodes[toolbarButtonsCount - 1]);        rollButton.addEventListener("click", function(ev) { ev.preventDefault; var messages = document.querySelectorAll("[data-is-reply]"); var messageCount = messages.length; for (var i = 1; i < messageCount; i++) { messages[i].style.backgroundColor = ""; }           var messageNum = Math.floor(Math.random * (messageCount - 1)) + 1; messages[messageNum].style.backgroundColor = "#ffffb5"; window.location.hash = messageNum.toString; });   } });