MediaWiki:Gadget-flashAnchored.js

// By Equazcion: http://terraria.gamepedia.com/User:Equazcion $(function{

if (window.location.hash.length > 0){ var hash = window.location.hash; flash($(hash)); } window.onhashchange = function { var hash = window.location.hash; flash($(hash)); } var hash;

function findFlashable(obj){ var flashable = [ 'tr', 'h1', 'h2', 'h3', 'h4', 'h5', 'li', 'div' ]; if ($.inArray(obj.prop('tagName'), flashable) < 0){ var newObj; $.each(flashable, function(data, val){		  newObj = obj.closest(val); 		   if (newObj.length > 0) { return false; }		}); return newObj; } else { return obj; } }

function flash(obj){ var obj = findFlashable(obj);

//window.scrollBy(0, -70); $('html, body').animate({		scrollTop: $(obj).offset.top - 20	}, 1500);

obj.css('transition',''); obj.css('background-color','#fff'); setTimeout(function{		obj.css('transition','background-color 150ms ease-in'); 		obj.css('background-color','#66CCFF');		setTimeout(function{ obj.css('transition','background-color 1000ms ease-out'); setTimeout(function{				obj.css('background','#FFE3D5'); 				setTimeout(function{ obj.css('transition',''); },1000);			},20);		},150);	},1); }

});