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.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//[[User:Markhurd/hidetopcontrib.js]]// Based on [[User:Ais523/hidetopcontrib.js]]// By a suggestion by [[User:Discospinster]]// 090325 MEH Fixed where it is not hiding all (top)s, starting with redirects// and continuing after any regex mismatch.// 090615 MEH Cater for new <span class="mw-uctop">// Add userHideAllSubsequent user setting.// Fix issue reported by [[User talk:Markhurd/hidetopcontrib.js#Bug|Lenore]].// 100407 MEH Use simplified regex that works on IE8.// 100413 MEH Cater for new pages.// 100428 MEH Cater better for new pages.// 100519 User:Ale_jrb Cater for Single-Revision Deletion, newly available to Admins.// 110520 User:Waldir Better page check.// 120206 MEH Cater for IE renderer differences.// 120207 MEH Cater for all skins.// 120321 MEH Cater for [[Wikipedia:Added or removed characters|WP:AORC]] by removing support for top not using the mw-uctop class.// 121123 User:Waldir Allow user configuration of link location and text.// 150121 MEH Remove legacy Javascript.// 170608 Fixed dependency declaration for mediawiki.util// 180413 User:Amorymeltzer allow for compatibility with a couple other scripts present on contributions page// 200107 User:Suffusion_of_Yellow use mw-contributions-title class instead of guessing which link is to the title// 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(typeofuserHideAllSubsequent=='undefined')userHideAllSubsequent=false;if(typeofportletId=='undefined')portletId='p-cactions';if(typeofportletText=='undefined')portletText='show/hide top';functionhidetopcontrib(){vari,li,a;li=document.getElementById("bodyContent");if(li===null)li=document.getElementById("article");if(li===null)li=document.getElementById("mw_main");li=li.getElementsByTagName("li");i=-1;a=newArray();while(++i<li.length){vars,t,links;links=li[i].getElementsByClassName("mw-contributions-title");if(typeoflinks=='undefined'||links.length!=1)continue;t=links[0].innerHTML;if(/* li[i].getElementsByTagName("strong").length>0|| */li[i].innerHTML.match(/mw\-uctop/i)!=undefined)s="none";elses="";if(a[t]!=undefined)s=userHideAllSubsequent?"none":a[t];elsea[t]=s;if(s!="")// li[i].innerHTML=li[i].innerHTML + ":'" + s + "'";li[i].style.display=(li[i].style.display=="none"?"list-item":"none");}}$.when(mw.loader.using('mediawiki.util'),$.ready).done(function(){if(mw.config.get('wgCanonicalSpecialPageName')=='Contributions'){varhtPortletLink=mw.util.addPortletLink(portletId,'#',portletText,'ca-hidetop',"Show/hide pages for which you're the top contributor",'');$(htPortletLink).click(function(e){e.preventDefault();hidetopcontrib();});}});//</nowiki></pre>//[[Category:Wikipedia scripts]]