User:Grunny/shhack.js

/** * Quick, dirty and ugly hack to allow a button to show/hide any class (purely for testing) -- Grunny */ $( function {	$( '.show-hide-togglebtn' ).click( function  { var	hideBtnClasses = $( this ).attr( 'class' ).split( ' ' ), $hideClass, $hideContent; for( var i in hideBtnClasses ) { if( hideBtnClasses[i].indexOf( 'hideable-' ) !== -1 ) { $hideClass = $( '.' + hideBtnClasses[i] ); $hideContent = $( '.' + hideBtnClasses[i].split( 'hideable-' )[1] ); break; }		}		if( !$hideContent || !$hideClass ) { return; }		if( $( this ).text == '[hide]' ) { $hideContent.hide; $hideClass.text( '[show]' ); } else { $hideContent.show; $hideClass.text( '[hide]' ); }	} ); } );