External Libraries: Update jQuery hoverIntent to version 1.10.1.
This updates the `jquery-hoverintent` dependency from 1.8.3 to 1.10.1. For a full list of changes, see https://github.com/briancherne/jquery-hoverIntent/compare/v1.8.3...v1.10.1. Fixes #52686. Built from https://develop.svn.wordpress.org/trunk@50521 git-svn-id: http://core.svn.wordpress.org/trunk@50134 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
de074081d1
commit
efaa79d347
|
@ -1,13 +1,14 @@
|
|||
/*!
|
||||
* hoverIntent v1.8.3 // 2014.08.11 // jQuery v1.9.1+
|
||||
* http://cherne.net/brian/resources/jquery.hoverIntent.html
|
||||
* hoverIntent v1.10.1 // 2019.10.05 // jQuery v1.7.0+
|
||||
* http://briancherne.github.io/jquery-hoverIntent/
|
||||
*
|
||||
* You may use hoverIntent under the terms of the MIT license. Basically that
|
||||
* means you are free to use hoverIntent as long as this header is left intact.
|
||||
* Copyright 2007, 2014 Brian Cherne
|
||||
* Copyright 2007-2019 Brian Cherne
|
||||
*/
|
||||
|
||||
/* hoverIntent is similar to jQuery's built-in "hover" method except that
|
||||
|
||||
/**
|
||||
* hoverIntent is similar to jQuery's built-in "hover" method except that
|
||||
* instead of firing the handlerIn function immediately, hoverIntent checks
|
||||
* to see if the user's mouse has slowed down (beneath the sensitivity
|
||||
* threshold) before firing the event. The handlerOut function is only
|
||||
|
@ -29,87 +30,135 @@
|
|||
* @param selector selector OR undefined
|
||||
* @author Brian Cherne <brian(at)cherne(dot)net>
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
;(function(factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory(require('jquery'));
|
||||
} else if (jQuery && !jQuery.fn.hoverIntent) {
|
||||
factory(jQuery);
|
||||
}
|
||||
})(function($) {
|
||||
'use strict';
|
||||
|
||||
// default configuration values
|
||||
var _cfg = {
|
||||
interval: 100,
|
||||
sensitivity: 6,
|
||||
timeout: 0
|
||||
};
|
||||
|
||||
// counter used to generate an ID for each instance
|
||||
var INSTANCE_COUNT = 0;
|
||||
|
||||
// current X and Y position of mouse, updated during mousemove tracking (shared across instances)
|
||||
var cX, cY;
|
||||
|
||||
// saves the current pointer position coordinates based on the given mousemove event
|
||||
var track = function(ev) {
|
||||
cX = ev.pageX;
|
||||
cY = ev.pageY;
|
||||
};
|
||||
|
||||
// compares current and previous mouse positions
|
||||
var compare = function(ev,$el,s,cfg) {
|
||||
// compare mouse positions to see if pointer has slowed enough to trigger `over` function
|
||||
if ( Math.sqrt( (s.pX-cX)*(s.pX-cX) + (s.pY-cY)*(s.pY-cY) ) < cfg.sensitivity ) {
|
||||
$el.off(s.event,track);
|
||||
delete s.timeoutId;
|
||||
// set hoverIntent state as active for this element (permits `out` handler to trigger)
|
||||
s.isActive = true;
|
||||
// overwrite old mouseenter event coordinates with most recent pointer position
|
||||
ev.pageX = cX; ev.pageY = cY;
|
||||
// clear coordinate data from state object
|
||||
delete s.pX; delete s.pY;
|
||||
return cfg.over.apply($el[0],[ev]);
|
||||
} else {
|
||||
// set previous coordinates for next comparison
|
||||
s.pX = cX; s.pY = cY;
|
||||
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
|
||||
s.timeoutId = setTimeout( function(){compare(ev, $el, s, cfg);} , cfg.interval );
|
||||
}
|
||||
};
|
||||
|
||||
// triggers given `out` function at configured `timeout` after a mouseleave and clears state
|
||||
var delay = function(ev,$el,s,out) {
|
||||
var data = $el.data('hoverIntent');
|
||||
if (data) {
|
||||
delete data[s.id];
|
||||
}
|
||||
return out.apply($el[0],[ev]);
|
||||
};
|
||||
|
||||
$.fn.hoverIntent = function(handlerIn,handlerOut,selector) {
|
||||
// instance ID, used as a key to store and retrieve state information on an element
|
||||
var instanceId = INSTANCE_COUNT++;
|
||||
|
||||
// default configuration values
|
||||
var cfg = {
|
||||
interval: 100,
|
||||
sensitivity: 6,
|
||||
timeout: 0
|
||||
};
|
||||
|
||||
if ( typeof handlerIn === "object" ) {
|
||||
cfg = $.extend(cfg, handlerIn );
|
||||
} else if ($.isFunction(handlerOut)) {
|
||||
// extend the default configuration and parse parameters
|
||||
var cfg = $.extend({}, _cfg);
|
||||
if ( $.isPlainObject(handlerIn) ) {
|
||||
cfg = $.extend(cfg, handlerIn);
|
||||
if ( !$.isFunction(cfg.out) ) {
|
||||
cfg.out = cfg.over;
|
||||
}
|
||||
} else if ( $.isFunction(handlerOut) ) {
|
||||
cfg = $.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector } );
|
||||
} else {
|
||||
cfg = $.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut } );
|
||||
}
|
||||
|
||||
// instantiate variables
|
||||
// cX, cY = current X and Y position of mouse, updated by mousemove event
|
||||
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
|
||||
var cX, cY, pX, pY;
|
||||
|
||||
// A private function for getting mouse position
|
||||
var track = function(ev) {
|
||||
cX = ev.pageX;
|
||||
cY = ev.pageY;
|
||||
};
|
||||
|
||||
// A private function for comparing current and previous mouse position
|
||||
var compare = function(ev,ob) {
|
||||
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
|
||||
// compare mouse positions to see if they've crossed the threshold
|
||||
if ( Math.sqrt( (pX-cX)*(pX-cX) + (pY-cY)*(pY-cY) ) < cfg.sensitivity ) {
|
||||
$(ob).off("mousemove.hoverIntent",track);
|
||||
// set hoverIntent state to true (so mouseOut can be called)
|
||||
ob.hoverIntent_s = true;
|
||||
return cfg.over.apply(ob,[ev]);
|
||||
} else {
|
||||
// set previous coordinates for next time
|
||||
pX = cX; pY = cY;
|
||||
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
|
||||
ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
|
||||
}
|
||||
};
|
||||
|
||||
// A private function for delaying the mouseOut function
|
||||
var delay = function(ev,ob) {
|
||||
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
|
||||
ob.hoverIntent_s = false;
|
||||
return cfg.out.apply(ob,[ev]);
|
||||
};
|
||||
|
||||
// A private function for handling mouse 'hovering'
|
||||
var handleHover = function(e) {
|
||||
// copy objects to be passed into t (required for event object to be passed in IE)
|
||||
// cloned event to pass to handlers (copy required for event object to be passed in IE)
|
||||
var ev = $.extend({},e);
|
||||
var ob = this;
|
||||
|
||||
// cancel hoverIntent timer if it exists
|
||||
if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
|
||||
// the current target of the mouse event, wrapped in a jQuery object
|
||||
var $el = $(this);
|
||||
|
||||
// if e.type === "mouseenter"
|
||||
if (e.type === "mouseenter") {
|
||||
// read hoverIntent data from element (or initialize if not present)
|
||||
var hoverIntentData = $el.data('hoverIntent');
|
||||
if (!hoverIntentData) { $el.data('hoverIntent', (hoverIntentData = {})); }
|
||||
|
||||
// read per-instance state from element (or initialize if not present)
|
||||
var state = hoverIntentData[instanceId];
|
||||
if (!state) { hoverIntentData[instanceId] = state = { id: instanceId }; }
|
||||
|
||||
// state properties:
|
||||
// id = instance ID, used to clean up data
|
||||
// timeoutId = timeout ID, reused for tracking mouse position and delaying "out" handler
|
||||
// isActive = plugin state, true after `over` is called just until `out` is called
|
||||
// pX, pY = previously-measured pointer coordinates, updated at each polling interval
|
||||
// event = string representing the namespaced event used for mouse tracking
|
||||
|
||||
// clear any existing timeout
|
||||
if (state.timeoutId) { state.timeoutId = clearTimeout(state.timeoutId); }
|
||||
|
||||
// namespaced event used to register and unregister mousemove tracking
|
||||
var mousemove = state.event = 'mousemove.hoverIntent.hoverIntent'+instanceId;
|
||||
|
||||
// handle the event, based on its type
|
||||
if (e.type === 'mouseenter') {
|
||||
// do nothing if already active
|
||||
if (state.isActive) { return; }
|
||||
// set "previous" X and Y position based on initial entry point
|
||||
pX = ev.pageX; pY = ev.pageY;
|
||||
state.pX = ev.pageX; state.pY = ev.pageY;
|
||||
// update "current" X and Y position based on mousemove
|
||||
$(ob).on("mousemove.hoverIntent",track);
|
||||
$el.off(mousemove,track).on(mousemove,track);
|
||||
// start polling interval (self-calling timeout) to compare mouse coordinates over time
|
||||
if (!ob.hoverIntent_s) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
|
||||
|
||||
// else e.type == "mouseleave"
|
||||
} else {
|
||||
state.timeoutId = setTimeout( function(){compare(ev,$el,state,cfg);} , cfg.interval );
|
||||
} else { // "mouseleave"
|
||||
// do nothing if not already active
|
||||
if (!state.isActive) { return; }
|
||||
// unbind expensive mousemove event
|
||||
$(ob).off("mousemove.hoverIntent",track);
|
||||
$el.off(mousemove,track);
|
||||
// if hoverIntent state is true, then call the mouseOut function after the specified delay
|
||||
if (ob.hoverIntent_s) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
|
||||
state.timeoutId = setTimeout( function(){delay(ev,$el,state,cfg.out);} , cfg.timeout );
|
||||
}
|
||||
};
|
||||
|
||||
// listen for mouseenter and mouseleave
|
||||
return this.on({'mouseenter.hoverIntent':handleHover,'mouseleave.hoverIntent':handleHover}, cfg.selector);
|
||||
};
|
||||
})(jQuery);
|
||||
});
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
/*! This file is auto-generated */
|
||||
!function(I){I.fn.hoverIntent=function(e,t,n){function r(e){o=e.pageX,v=e.pageY}var o,v,i,u,s={interval:100,sensitivity:6,timeout:0},s="object"==typeof e?I.extend(s,e):I.isFunction(t)?I.extend(s,{over:e,out:t,selector:n}):I.extend(s,{over:e,out:e,selector:t}),h=function(e,t){if(t.hoverIntent_t=clearTimeout(t.hoverIntent_t),Math.sqrt((i-o)*(i-o)+(u-v)*(u-v))<s.sensitivity)return I(t).off("mousemove.hoverIntent",r),t.hoverIntent_s=!0,s.over.apply(t,[e]);i=o,u=v,t.hoverIntent_t=setTimeout(function(){h(e,t)},s.interval)},t=function(e){var n=I.extend({},e),o=this;o.hoverIntent_t&&(o.hoverIntent_t=clearTimeout(o.hoverIntent_t)),"mouseenter"===e.type?(i=n.pageX,u=n.pageY,I(o).on("mousemove.hoverIntent",r),o.hoverIntent_s||(o.hoverIntent_t=setTimeout(function(){h(n,o)},s.interval))):(I(o).off("mousemove.hoverIntent",r),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,s.out.apply(t,[e])},s.timeout)))};return this.on({"mouseenter.hoverIntent":t,"mouseleave.hoverIntent":t},s.selector)}}(jQuery);
|
||||
!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";function d(e){u=e.pageX,r=e.pageY}var u,r,v={interval:100,sensitivity:6,timeout:0},a=0,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,d),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=a++,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,d).on(t,d),v.timeoutId=setTimeout(function(){p(u,r,v,s)},s.interval)):v.isActive&&(r.off(t,d),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)}});
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.8-alpha-50520';
|
||||
$wp_version = '5.8-alpha-50521';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue