User:Sir No/common.js

/* Bracket Highlighting - Adapted from Liquipedia - http://wiki.teamliquid.net/dota2/MediaWiki:Common.js */ var bracketGame; $(document).ready(function {	$('.bracket-game').each( function { if ($(this).find('.bracket-game-details').length > 0) { var margin = $(this).find(':first-child').height - 6; $(this).prepend(' '); }	});	$('.match-row').each( function { if ($(this).find('.bracket-game-details').length > 0) { $(this).find('td:eq(2)').prepend('  '); }	});	$('.bracket-team-top, .bracket-team-bottom, .bracket-team-top-oldschool, .bracket-team-bottom-oldschool, .bracket-game .icon').click( function (event) { var bracket = $(this).closest('.bracket'), detailsHeight, detailsWidth, spaceOnTheRight; if (bracketGame != null) { bracketGame.children('.bracket-game-details').toggle; if (bracketGame[0] === $(this).closest('.bracket-game')[0]) { bracketGame = null; return; }		}		bracketGame = $(this).closest('.bracket-game'); detailsHeight= bracketGame.children('.bracket-game-details').height; detailsWidth = bracketGame.children('.bracket-game-details').width; bracketGame.children('.bracket-game-details').css('margin-top', -detailsHeight / 2); spaceOnTheRight = Math.max($(window).width, bracket.offset.left + bracket.outerWidth) - (bracketGame.offset.left + bracketGame.outerWidth); if (spaceOnTheRight < detailsWidth && bracketGame.offset.left > detailsWidth) { bracketGame.children('.bracket-game-details').css('margin-left', -detailsWidth - 1); } else { bracketGame.children('.bracket-game-details').css('margin-left', bracketGame.width); }		bracketGame.children('.bracket-game-details').toggle; event.stopPropagation; });	$('.match-row').click(function (event) { if (bracketGame != null) { bracketGame.find('.bracket-game-details').toggle; if (bracketGame[0] === $(this)[0]) { bracketGame = null; return; }		}		bracketGame = $(this); var height = bracketGame.find('.bracket-game-details').height; bracketGame.find('.bracket-game-details').css('margin-top', 3); bracketGame.find('.bracket-game-details').toggle; event.stopPropagation; });

$('.bracket-game-details').click(function (event) {		event.stopPropagation;	}); }); /* End Bracket Highlighting */