User:Ale jrb/Scripts/tophide.js

function topHideMain { var me = this;

this.init = function { if ( ( wgAction == 'view' ) && ( wgPageName == 'Special:Contributions' ) ) { var bodyContent = document.getElementById ( 'bodyContent' ); regTest = /class="mw-numlink">500<\/a>\)<\/p>/ig;

if ( typeof topHideDefault === "undefined" ) topHideDefault = 'hide'; if ( topHideDefault == 'hide' ) { bodyContent.innerHTML = bodyContent.innerHTML.replace ( regTest, "class=\"mw-numlink\">500) (show top edits ) " );					topHide.hide ;				} else {					bodyContent.innerHTML = bodyContent.innerHTML.replace ( regTest, "class=\"mw-numlink\">500) (hide top edits ) " ); }

wa_popups ( 'refresh' ); }		}		this.hide = function { if ( ( wgAction == 'view' ) && ( wgPageName == 'Special:Contributions' ) ) { document.getElementById ( 'tophider' ).innerHTML = 'show top edits';

var bodyContent = document.getElementById ( 'bodyContent' ); regTest = /( (?!<\/li)(?:.+?) \(top\)<\/span>(?:.+?)<\/li>)/ig; bodyContent.innerHTML = bodyContent.innerHTML.replace ( regTest, "" ); wa_popups ( 'refresh' ); }			return false; }

this.show = function { if ( ( wgAction == 'view' ) && ( wgPageName == 'Special:Contributions' ) ) { document.getElementById ( 'tophider' ).innerHTML = 'hide top edits';

var bodyContent = document.getElementById ( 'bodyContent' ); regTest = //ig; bodyContent.innerHTML = bodyContent.innerHTML.replace ( regTest, "$1" ); wa_popups ( 'refresh' ); }			return false; }	}	importScript ( 'User:Ale_jrb/Scripts/waLib2.js' ); var topHide = new topHideMain ; hookEvent ( 'load', topHide.init );