MediaWiki:Gadget-teamHighlight.js

$( function {	var $teamhighlight = $('.teamhighlight');	var $teamhighlighter = $('.teamhighlighter');	var currentTeamClicked = false;	function highlight(team) {		if (! currentTeamClicked) {			$('.teamhighlight[data-teamhighlight="' + team + '"]').each(function { $(this).addClass('team-highlighted'); });		}	}	function unhighlight {		if (! currentTeamClicked) {			$teamhighlight.each(function { $(this).removeClass('team-highlighted',''); });		}	}	$teamhighlighter.each(function { $(this).hover(function {			highlight($(this).attr('data-teamhighlight'))		},		unhighlight); $(this).click(function {			if (currentTeamClicked) {				currentTeamClicked = false;				unhighlight;				highlight($(this).attr('data-teamhighlight'));			}			else {				currentTeamClicked = $(this).attr('data-teamhighlight');			}		}); }); });

// highlighting for opponents in crossboxes // highligting for rows is taken care of by the general team highlighter $(function {	var $crossboxCells = $('.crossbox-cell')	function highlight(team) {		$('[data-crossbox-highlight-vs="' + team + '"]').each(function { $(this).addClass('team-vs-highlighted'); });	}	function unhighlight {		$crossboxCells.each(function { $(this).removeClass('team-vs-highlighted',''); });	}	$crossboxCells.each(function { $(this).hover(function {			highlight($(this).attr('data-crossbox-highlight-vs'));		},		unhighlight); }); });