User:Markhurd/hidetopcontrib.js: Difference between revisions

Content deleted Content added
Markhurd (talk | contribs)
m Mention change in revision history
// 100705 User:Ale_jrb Adds "hideTop" variable to move the button lower when false
Line 11:
// 100428 MEH Cater better for new pages.
// 100519 User:Ale_jrb Cater for Single-Revision Deletion, newly available to Admins.
// 100705 User:Ale_jrb Adds "hideTop" variable to move the button lower when false
// 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.
// If userHideTop=false, the button moves from the top bar to after the (20 | 50 | 100 | 250 | 500) marker
//<pre><nowiki>
if ( typeof userHideAllSubsequent === 'undefined' ) userHideAllSubsequent = false;
if ( typeof userHideTop === 'undefined' ) userHideTop = true;
userHideAllSubsequent=false;
function hidetopcontrib()
Line 58 ⟶ 60:
addOnloadHook(function () {
if ( userHideTop === true ) {
if((___location.href.indexOf("Special:Contributions")!=-1||
if ( wgCanonicalSpecialPageName === 'Contributions' ) {
___location.href.indexOf("Special%3AContributions")!=-1))
var button = document.createElement ( 'span' );
addPortletLink('p-cactions', 'javascript:hidetopcontrib()', 'show/hide top', 'ca-hidetop',
button.id = 'hidetop-button';
"Show/hide pages for which you're the top contributor", '');
button.innerHTML = '&nbsp;(<a href="#" onclick="hidetopcontrib (); this.innerHTML = ( this.innerHTML == \'hide top contribs\' ? \'show top contribs\' : \'hide top contribs\' ); return false;">hide top contribs</a>)';
document.getElementById('bodyContent').childNodes[10].appendChild ( button );
}
} else {
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", '');
}
});