User:Markhurd/hidetopcontrib.js: Difference between revisions

Content deleted Content added
Markhurd (talk | contribs)
Cater better for new pages.
Ale jrb (talk | contribs)
m fix handy script to work with revdelete
Line 10:
// 100413 MEH Cater for new pages.
// 100428 MEH Cater better for new pages.
 
// This script hides lines according to who has the top contribution for a page.
// If userHideAllSubsequent=true, all subsequent contributions are hidden too, more like watchlists.
 
//<pre><nowiki>
 
if (typeof userHideAllSubsequent=='undefined')
userHideAllSubsequent=false;
 
function hidetopcontrib()
{
Line 28:
while(++i<li.length)
{
var s,t,links,b;
links=li[i].getElementsByTagName("a");
 
elseb = 2;
if (typeof links=='undefined' || links.length<3)
if(li[i].innerHTML.match(/<abbr +[^>]*class *= *"newpage"/)==undefined) b++;
if(li[i].innerHTML.match(/class *= *"mw-revdelundel-link"/)!=undefined) b++;
if (typeof links=='undefined' || links.length<3(b+1))
continue;
 
if(lit=links[ib].innerHTML.match(/<abbr +[^>]*class *= *"newpage"/)!=undefined);
t=links[2].innerHTML;
else
t=links[3].innerHTML;
 
if(li[i].getElementsByTagName("strong").length>0||li[i].innerHTML.match(/mw\-uctop/)!=undefined)
s="none";
else
s="";
 
if(a[t]!=undefined)
s=userHideAllSubsequent?"none":a[t];
else
a[t]=s;
 
if(s!="")
// li[i].innerHTML=li[i].innerHTML + ":'" + s + "'";
Line 54 ⟶ 55:
}
}
 
addOnloadHook(function () {
if((___location.href.indexOf("Special:Contributions")!=-1||
Line 61 ⟶ 62:
"Show/hide pages for which you're the top contributor", '');
});
 
//</nowiki></pre>
//[[Category:Wikipedia scripts]]