User:Jorgenev/scripts/EnhancedUserContribsBETA.js

/* This script provides an interface for hiding various automated scripts from the contribs list. */

// Name, Regex var scripts1 = (>IG<)"],               ["SPIhelper", "Archiving case ((to)|(from))"],                ["Default Reversion", "(/wiki/Help:Reverting)|(Undid revision)"],                ["HotCat", ">HotCat<"],                ["popups", ">popups<"],                ["closeAFD", "((Closing debate, result was)|(> closed as))"],                ["NowCommonsReview", ">nowcommonsreviewer<"],                ["Checklinks", ">Checklinks<"],                ["AFCHelper4", "((Declining submission: submission)|(Your submission at <))"],                ["?AFDScript", "(adding orphaned AfD)|(Relisting <)"],                ["EasyBlock", "(You have been blocked)|(from this IP address, it has been blocked for)"

function update { var li = document.getElementById("bodyContent").getElementsByTagName("li"); var i = -1; while(++i<li.length) { var i2 = -1; var hide = false; while(++i2<scripts1.length) {  hide = hide || ( ( document.getElementsByName("masterscripts1")[0].checked || document.getElementsByName(scripts1[i2][0].replace(" ","") + "1")[0].checked ) && li[i].innerHTML.match(scripts1[i2][1]) ); } if(document.getElementById("mode1").innerHTML=="Show") {    hide = !hide; }

if(hide) {  li[i].style.display = "none"; } else {  li[i].style.display = "list-item"; } } }

function switchmode {    if(document.getElementById("mode1").innerHTML == "Show") {          document.getElementById("mode1").innerHTML = "Hide"; }     else {         document.getElementById("mode1").innerHTML = "Show"; }

update; }

function toggleMaster {   if(document.getElementsByName("masterscripts1")[0].checked) {        document.getElementById("subsections1").style.display = "none"; }    else {         document.getElementById("subsections1").style.display = "inline"; }

update; }

addOnloadHook(function {

if((location.href.indexOf("Special:Contributions")!=-1 || location.href.indexOf("Special%3AContributions")!=-1)) {   var li = document.getElementById("bodyContent").getElementsByTagName("li"); var index = -1; var counts = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; while(++index  0) {       add += " " + scripts1[i2][0] + " (" + counts[i2] + ")"; disp1 += counts[i2]; }     else {       add += " "; }     }      add += " "

if(disp1 > 0) {     document.getElementById("mw-sp-contributions-explain").innerHTML = ' Hide scripts (' + disp1 + ') : ' + add + document.getElementById("mw-sp-contributions-explain").innerHTML; } } }

);