MediaWiki talk:Common.js

temp for code

// ================================================================== // Testing of Cell highlighting to make some sort of "check box" // ================================================================== $(document).ready(function {	var checkCookieLen = 20;	var checkCookie = getCookie('checkBoxes').split('');

function cellHighlight(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('checkBoxes', checkCookie.join(''), 60 * 60 * 24 * 7); }

if (wgPageName == 'Check_Boxes_testing') { while (checkCookie.length < checkCookieLen) { checkCookie.push('0'); }

$('#checkBoxes tr').each(function(i) {			cellHighlight(this, checkCookie[i]);

$(this).mouseover(function {				cellHighlight(this, 2);			}).mouseout(function {				cellHighlight(this, checkCookie[i]);			}).click(function {				checkCookie[i] = 1 - checkCookie[i];				cellHighlight(this, checkCookie[i]);				save;			}); });

$('#checkBoxes').append(			$(' ').append( $(' ').attr('colspan', '1').append(					$(' ').attr('type', 'button').val('Reset marked locations').click(function { $('#checkBoxes tr').each(function(i) {							checkCookie[i] = '0';							cellHighlight(this, checkCookie[i]);						}); save; })				)			)		);	} });

/* */

$(document).ready(function {	var pengCookieLen = 20;	var pengCookie = getCookie('pengLocations').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('pengLocations', pengCookie.join(''), 60 * 60 * 24 * 7);	}	if (wgPageName == 'Distractions_and_Diversions_Locations') {		while (pengCookie.length < pengCookieLen) {			pengCookie.push('0');		}		$('#penglocations tr').each(function(i) { rowHighlight(this, pengCookie[i]); $(this).mouseover(function {				rowHighlight(this, 2);			}).mouseout(function {				rowHighlight(this, pengCookie[i]);			}).click(function {				pengCookie[i] = 1 - pengCookie[i];				rowHighlight(this, pengCookie[i]);				save;			}); });		$('#penglocations').append( $(' ').append(				$(' ').attr('colspan', '7').append( $(' ').attr('type', 'button').val('Reset marked locations').click(function {						$('#penglocations tr').each(function(i) { pengCookie[i] = '0'; rowHighlight(this, pengCookie[i]); });						save;					}) )			)		);	} });