WordPress/wp-includes/js/hoverIntent.min.js
Aaron Jorbin a870c7e8f3 Build/Test: Update dependencies for 5.0
Updates package dependencies to more modern versions, also adds .nvmrc and package-lock.json as followups to [43683] and [43571].

See #44600.
Fixes #45064.


Built from https://develop.svn.wordpress.org/branches/5.0@43684


git-svn-id: http://core.svn.wordpress.org/branches/5.0@43513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-10-09 02:52:45 +00:00

1 line
1.1 KiB
JavaScript

!function(a){a.fn.hoverIntent=function(e,t,n){var o,r,v,i,u={interval:100,sensitivity:6,timeout:0};u="object"==typeof e?a.extend(u,e):a.isFunction(t)?a.extend(u,{over:e,out:t,selector:n}):a.extend(u,{over:e,out:e,selector:t});var s=function(e){o=e.pageX,r=e.pageY},h=function(e,t){if(t.hoverIntent_t=clearTimeout(t.hoverIntent_t),Math.sqrt((v-o)*(v-o)+(i-r)*(i-r))<u.sensitivity)return a(t).off("mousemove.hoverIntent",s),t.hoverIntent_s=!0,u.over.apply(t,[e]);v=o,i=r,t.hoverIntent_t=setTimeout(function(){h(e,t)},u.interval)},I=function(e){var n=a.extend({},e),o=this;o.hoverIntent_t&&(o.hoverIntent_t=clearTimeout(o.hoverIntent_t)),"mouseenter"===e.type?(v=n.pageX,i=n.pageY,a(o).on("mousemove.hoverIntent",s),o.hoverIntent_s||(o.hoverIntent_t=setTimeout(function(){h(n,o)},u.interval))):(a(o).off("mousemove.hoverIntent",s),o.hoverIntent_s&&(o.hoverIntent_t=setTimeout(function(){var e,t;e=n,(t=o).hoverIntent_t=clearTimeout(t.hoverIntent_t),t.hoverIntent_s=!1,u.out.apply(t,[e])},u.timeout)))};return this.on({"mouseenter.hoverIntent":I,"mouseleave.hoverIntent":I},u.selector)}}(jQuery);