User:Jorgenev/scripts/EnhancedUserContribs.js
Appearance
< User:Jorgenev | scripts
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Jorgenev/scripts/EnhancedUserContribs. |
/* This script provides an interface for hiding various automated scripts from the contribs list.
*/
// Name, Regex
var scripts1 = [["Huggle", "Wikipedia:HG"],
["Twinkle", "Wikipedia:TW"],
["Dab solver", "view/Dab solver"],
["CSD Helper", ">CSDH<"],
["AssessorTags", ">AssessorTags<"],
["Dabfix", ">Dabfix<"],
["AWB", ">AWB<"],
["WPCleaner", ">WPCleaner<"],
["Igloo", "(>GLOO<)|(>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();
}
$(function () {
if((location.href.indexOf("Special:Contributions")!=-1||
location.href.indexOf("Special%3AContributions")!=-1))
{
var li = document.getElementById("bodyContent").getElementsByTagName("li");
var index;
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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
while(++index <scripts1.length)
{
var index2;
index2 = -1;
while(++index2<li.length)
{
if(li[index2].innerHTML.match(scripts1[index][1]))
{
counts[index]++;
}
}
}
var add = "";
var i2 = -1;
var disp1 = 0;
while(++i2<scripts1.length)
{
if(counts[i2] > 0)
{
add += "<input type=checkbox name="+ scripts1[i2][0].replace(" ","") + "1" + " onclick=javascript:update(); /> "+ scripts1[i2][0] + " (" + counts[i2] + ")";
disp1 += counts[i2];
}
else
{
add += "<span name="+ scripts1[i2][0].replace(" ","") + "1 /> ";
}
}
add += "</span>"
var explainNode = document.getElementById("mw-sp-contributions-explain");
if(disp1 > 0 && explainNode){
explainNode.innerHTML = '<hr><input type=checkbox name=masterscripts1 onclick=javascript:toggleMaster(); /><button id=mode1 type=button style="border-style:groove; padding: 0px; margin:0px;" onclick=javascript:switchmode(); >Hide</button> scripts (' + disp1 + ')<span id=subsections1>:<br /> ' +
add + explainNode.innerHTML;
}}
});