User:Bitoffish/common.js

/* var SHOW=1; var HIDE=2; var showing = false;

document.onkeyup = function KeyCheck(event){ var KeyID = event.keyCode;

switch(KeyID) {	  	case 16: showHideLinks(HIDE); break; }

} document.onkeydown = function KeyDown(event) { var KeyID = event.keyCode; switch(KeyID) {     case 16: showHideLinks(SHOW); break; }

} function showHideLinks(showHide) { var theRules = new Array;

var stylesheet = document.styleSheets[(document.styleSheets.length - 1)];

for( var i in document.styleSheets ){ if( document.styleSheets[i].href && document.styleSheets[i].href.indexOf("modules=user") ) stylesheet = document.styleSheets[i]; }

if (stylesheet.cssRules) { theRules = stylesheet.cssRules; } else if (stylesheet.rules) { theRules = stylesheet.rules; }	switch (showHide) {		case SHOW : { if ( !showing) {				deleteRules(stylesheet); stylesheet.insertRule('a {color:#0B0080;}', theRules.length); stylesheet.insertRule('a:visited {color:#0645AD;}', theRules.length); stylesheet.insertRule('a, a:visited,a:active {text-decoration:underline;}', theRules.length); }			break; }

case HIDE : { deleteRules(stylesheet); stylesheet.insertRule('a, a:visited,a:active {color:#000;	}', theRules.length); stylesheet.insertRule('a, a:visited,a:active {text-decoration:none;}', theRules.length); break; }	} }

deleteRules = function(stylesheet) {	// delete rules in this sheet for (var i in stylesheet.length) { stylesheet.deleteRule(i); } }

setStyleRule = function(selector, rule) {

if( stylesheet.addRule ){ stylesheet.addRule(selector, rule); } else if( stylesheet.insertRule ){ stylesheet.insertRule(selector + ' { ' + rule + ' }', stylesheet.cssRules.length); } }