﻿(function(e) { e.fn.hoverIntent = function(l, m) { var d = { sensitivity: 7, interval: 100, timeout: 0 }; d = e.extend(d, m ? { over: l, out: m} : l); var g, h, i, j, k = function(c) { g = c.pageX; h = c.pageY }, n = function(c, a) { a.hoverIntent_t = clearTimeout(a.hoverIntent_t); if (Math.abs(i - g) + Math.abs(j - h) < d.sensitivity) { e(a).unbind("mousemove", k); a.hoverIntent_s = 1; return d.over.apply(a, [c]) } else { i = g; j = h; a.hoverIntent_t = setTimeout(function() { n(c, a) }, d.interval) } }, o = function(c) { for (var a = (c.type == "mouseover" ? c.fromElement : c.toElement) || c.relatedTarget; a && a != this; ) try { a = a.parentNode } catch (p) { a = this } if (a == this) return false; var f = jQuery.extend({}, c), b = this; if (b.hoverIntent_t) b.hoverIntent_t = clearTimeout(b.hoverIntent_t); if (c.type == "mouseover") { i = f.pageX; j = f.pageY; e(b).bind("mousemove", k); if (b.hoverIntent_s != 1) b.hoverIntent_t = setTimeout(function() { n(f, b) }, d.interval) } else { e(b).unbind("mousemove", k); if (b.hoverIntent_s == 1) b.hoverIntent_t = setTimeout(function() { b.hoverIntent_t = clearTimeout(b.hoverIntent_t); b.hoverIntent_s = 0; d.out.apply(b, [f]) }, d.timeout) } }; return this.mouseover(o).mouseout(o) } })(jQuery);
