User:MarkvA/monobook.js

$(document).ready(function {	var lightCookieLen = 20;	var lightCookie = getCookie('lightTable').split();	function HighlightRow(el, val) {		var cssText = ;		if (val == '2') {			cssText = 'background-color: #CCC !important';		} else if (val == '1') {			cssText = 'background-color: #CFC !important';		}		$(el).children('td').css('cssText', cssText);	}	function save {		setCookie('lightTable', lightCookie.join(''), 60 * 60 * 24 * 7);	}	if ( wgCanonicalNamespace == 0 ) {		while (lightCookie.length < lightCookieLen) {			lightCookie.push('0');		}		$('#lighttable tr').each(function(i) { HighlightRow(this, lightCookie[i]); $(this).mouseover(function {				HighlightRow(this, 2);			}).mouseout(function {				HighlightRow(this, lightCookie[i]);			}).click(function {				lightCookie[i] = 1 - lightCookie[i];				HighlightRow(this, lightCookie[i]);				save;			}); });		$('#lighttable').append( //TODO: Apply to each table on page $(' ').append(				$(' ').attr('colspan', '7').append( $(' ').attr('type', 'button').val('Reset').click(function {						$('#lighttable tr').each(function(i) { lightCookie[i] = '0'; HighlightRow(this, lightCookie[i]); });						save;					}) )			)		);	} });