User:Markhurd/hidetopcontrib.js: Difference between revisions

Content deleted Content added
Markhurd (talk | contribs)
Debugging
 
Markhurd (talk | contribs)
m whitespace fix
Line 1:
// [[User:Ais523/hidetopcontrib.js]]
// By a suggestion by [[User:Discospinster]]
// [[User:Ais523/hidetopcontrib.js]] // By a suggestion by [[User:Discospinster]] // 090325 MEH Attempting to fix where it is not hiding all (top)s.
 
// This script color-codes lines according to who has the top contribution for a page.
 
//<pre><nowiki>
// [[User:Ais523/hidetopcontrib.js]] // By a suggestion by [[User:Discospinster]] // 090325 MEH Attempting to fix where it is not hiding all (top)s.
 
// This script color-codes lines according to who has the top contribution for a page. //<pre><nowiki> function hidetopcontrib() { var i,li,a; li=document.getElementById("bodyContent"); li=li.getElementsByTagName("li"); i=-1; a=new Array(); while(++i<li.length) { var s,t; t=li[i].innerHTML.match(/"\/wiki\/([^"]*)"/)[1]; if(li[i].getElementsByTagName("strong").length>0) s="none"; else s=""; if(a[t]!=undefined) s=a[t]; else a[t]=s; if(s!="")
 
function hidetopcontrib()
{
var i,li,a;
li=document.getElementById("bodyContent");
li=li.getElementsByTagName("li");
i=-1;
a=new Array();
while(++i<li.length)
{
var s,t;
t=li[i].innerHTML.match(/"\/wiki\/([^"]*)"/)[1];
if(li[i].getElementsByTagName("strong").length>0)
s="none";
else
s="";
 
if(a[t]!=undefined)
s=a[t];
else
a[t]=s;
 
if(s!="")
{
 
// li[i].style.display=(li[i].style.display=="none"?"list-item":"none");
 
li[i].innerHTML=li[i].innerHTML + ":";
 
}
} } } addOnloadHook(function () { if((___location.href.indexOf("Special:Contributions")!=-1|| ___location.href.indexOf("Special%3AContributions")!=-1)) addPortletLink('p-cactions', 'javascript:hidetopcontrib()', 'show/hide top', 'ca-hidetop', "Show/hide pages for which you're the top contributor", ''); }); //</nowiki></pre>
}
}
addOnloadHook(function () {
if((___location.href.indexOf("Special:Contributions")!=-1||
___location.href.indexOf("Special%3AContributions")!=-1))
addPortletLink('p-cactions', 'javascript:hidetopcontrib()', 'show/hide top', 'ca-hidetop',
"Show/hide pages for which you're the top contributor", '');
});
//</nowiki></pre>