1(function($) { 2 $.fn.hoverIntent = function(f, g) { 3 var cfg = { 4 sensitivity: 7, 5 interval: 100, 6 timeout: 0 7 }; 8 cfg = $.extend(cfg, g ? { 9 over: f, 10 out: g 11 } : f); 12 var cX, cY, pX, pY; 13 var track = function(ev) { 14 cX = ev.pageX; 15 cY = ev.pageY; 16 }; 17 var compare = function(ev, ob) { 18 ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); 19 if ((Math.abs(pX - cX) + Math.abs(pY - cY)) < cfg.sensitivity) { 20 $(ob).unbind("mousemove", track); 21 ob.hoverIntent_s = 1; 22 return cfg.over.apply(ob, [ev]); 23 } else { 24 pX = cX; 25 pY = cY; 26 ob.hoverIntent_t = setTimeout(function() { 27 compare(ev, ob); 28 }, cfg.interval); 29 } 30 }; 31 var delay = function(ev, ob) { 32 ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); 33 ob.hoverIntent_s = 0; 34 return cfg.out.apply(ob, [ev]); 35 }; 36 var handleHover = function(e) { 37 var ev = jQuery.extend({}, e); 38 var ob = this; 39 if (ob.hoverIntent_t) { 40 ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); 41 } 42 if (e.type == "mouseenter") { 43 pX = ev.pageX; 44 pY = ev.pageY; 45 $(ob).bind("mousemove", track); 46 if (ob.hoverIntent_s != 1) { 47 ob.hoverIntent_t = setTimeout(function() { 48 compare(ev, ob); 49 }, cfg.interval); 50 } 51 } else { 52 $(ob).unbind("mousemove", track); 53 if (ob.hoverIntent_s == 1) { 54 ob.hoverIntent_t = setTimeout(function() { 55 delay(ev, ob); 56 }, cfg.timeout); 57 } 58 } 59 }; 60 return this.bind('mouseenter', handleHover).bind('mouseleave', handleHover); 61 }; 62})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.