WordPress/wp-includes/js/hoverIntent.min.js

2 lines
1.4 KiB
JavaScript

/*! This file is auto-generated */
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=e(require("jquery")):jQuery&&!jQuery.fn.hoverIntent&&e(jQuery)}(function(i){"use strict";var u,r,v={interval:100,sensitivity:6,timeout:0},d=0,a=function(e){u=e.pageX,r=e.pageY},p=function(e,t,n,o){if(Math.sqrt((n.pX-u)*(n.pX-u)+(n.pY-r)*(n.pY-r))<o.sensitivity)return t.off(n.event,a),delete n.timeoutId,n.isActive=!0,e.pageX=u,e.pageY=r,delete n.pX,delete n.pY,o.over.apply(t[0],[e]);n.pX=u,n.pY=r,n.timeoutId=setTimeout(function(){p(e,t,n,o)},o.interval)};i.fn.hoverIntent=function(e,t,n){var o=d++,s=i.extend({},v);i.isPlainObject(e)?(s=i.extend(s,e),i.isFunction(s.out)||(s.out=s.over)):s=i.isFunction(t)?i.extend(s,{over:e,out:t,selector:n}):i.extend(s,{over:e,out:e,selector:t});t=function(e){var u=i.extend({},e),r=i(this),t=r.data("hoverIntent");t||r.data("hoverIntent",t={});var v=t[o];v||(t[o]=v={id:o}),v.timeoutId&&(v.timeoutId=clearTimeout(v.timeoutId));t=v.event="mousemove.hoverIntent.hoverIntent"+o;"mouseenter"===e.type?v.isActive||(v.pX=u.pageX,v.pY=u.pageY,r.off(t,a).on(t,a),v.timeoutId=setTimeout(function(){p(u,r,v,s)},s.interval)):v.isActive&&(r.off(t,a),v.timeoutId=setTimeout(function(){var e,t,n,o,i;e=u,t=r,n=v,o=s.out,(i=t.data("hoverIntent"))&&delete i[n.id],o.apply(t[0],[e])},s.timeout))};return this.on({"mouseenter.hoverIntent":t,"mouseleave.hoverIntent":t},s.selector)}});