MediaWiki:Common.js/highlightTable.js

// // ================================================================== // Adds row marking to the a hightlightTable // ================================================================== $(document).ready(function {	var lightCookieLen = 20;	var lightCookie = getCookie('lightTable').split();	function rowHighlight(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) { rowHighlight(this, lightCookie[i]); $(this).mouseover(function {				rowHighlight(this, 2);			}).mouseout(function {				rowHighlight(this, lightCookie[i]);			}).click(function {				lightCookie[i] = 1 - lightCookie[i];				rowHighlight(this, lightCookie[i]);				save;			}); });		$('#lighttable').append( $(' ').append(				$(' ').attr('colspan', '7').append( $(' ').attr('type', 'button').val('Reset marked locations').click(function {						$('#lighttable tr').each(function(i) { lightCookie[i] = '0'; rowHighlight(this, lightCookie[i]); });						save;					}) )			)		);	} }); //