Make WordPress Core

Changeset 31723


Ignore:
Timestamp:
03/11/2015 05:14:34 PM (10 years ago)
Author:
ocean90
Message:

Update hoverIntent to 1.8.1.

props rachelbaker, jesin.
fixes #31505.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/admin-bar.js

    r31111 r31723  
    44    if ( typeof(jQuery.fn.hoverIntent) == 'undefined' ) {
    55        /* jshint ignore:start */
    6         // hoverIntent r6 - Copy of wp-includes/js/hoverIntent.min.js
    7         (function(a){a.fn.hoverIntent=function(m,d,h){var j={interval:100,sensitivity:7,timeout:0};if(typeof m==="object"){j=a.extend(j,m)}else{if(a.isFunction(d)){j=a.extend(j,{over:m,out:d,selector:h})}else{j=a.extend(j,{over:m,out:m,selector:d})}}var l,k,g,f;var e=function(n){l=n.pageX;k=n.pageY};var c=function(o,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);if((Math.abs(g-l)+Math.abs(f-k))<j.sensitivity){a(n).off("mousemove.hoverIntent",e);n.hoverIntent_s=1;return j.over.apply(n,[o])}else{g=l;f=k;n.hoverIntent_t=setTimeout(function(){c(o,n)},j.interval)}};var i=function(o,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);n.hoverIntent_s=0;return j.out.apply(n,[o])};var b=function(p){var o=jQuery.extend({},p);var n=this;if(n.hoverIntent_t){n.hoverIntent_t=clearTimeout(n.hoverIntent_t)}if(p.type=="mouseenter"){g=o.pageX;f=o.pageY;a(n).on("mousemove.hoverIntent",e);if(n.hoverIntent_s!=1){n.hoverIntent_t=setTimeout(function(){c(o,n)},j.interval)}}else{a(n).off("mousemove.hoverIntent",e);if(n.hoverIntent_s==1){n.hoverIntent_t=setTimeout(function(){i(o,n)},j.timeout)}}};return this.on({"mouseenter.hoverIntent":b,"mouseleave.hoverIntent":b},j.selector)}})(jQuery);
     6        // hoverIntent v1.8.1 - Copy of wp-includes/js/hoverIntent.min.js
     7        !function(a){a.fn.hoverIntent=function(b,c,d){var e={interval:100,sensitivity:6,timeout:0};e="object"==typeof b?a.extend(e,b):a.isFunction(c)?a.extend(e,{over:b,out:c,selector:d}):a.extend(e,{over:b,out:b,selector:c});var f,g,h,i,j=function(a){f=a.pageX,g=a.pageY},k=function(b,c){return c.hoverIntent_t=clearTimeout(c.hoverIntent_t),Math.sqrt((h-f)*(h-f)+(i-g)*(i-g))<e.sensitivity?(a(c).off("mousemove.hoverIntent",j),c.hoverIntent_s=!0,e.over.apply(c,[b])):(h=f,i=g,c.hoverIntent_t=setTimeout(function(){k(b,c)},e.interval),void 0)},l=function(a,b){return b.hoverIntent_t=clearTimeout(b.hoverIntent_t),b.hoverIntent_s=!1,e.out.apply(b,[a])},m=function(b){var c=a.extend({},b),d=this;d.hoverIntent_t&&(d.hoverIntent_t=clearTimeout(d.hoverIntent_t)),"mouseenter"===b.type?(h=c.pageX,i=c.pageY,a(d).on("mousemove.hoverIntent",j),d.hoverIntent_s||(d.hoverIntent_t=setTimeout(function(){k(c,d)},e.interval))):(a(d).off("mousemove.hoverIntent",j),d.hoverIntent_s&&(d.hoverIntent_t=setTimeout(function(){l(c,d)},e.timeout)))};return this.on({"mouseenter.hoverIntent":m,"mouseleave.hoverIntent":m},e.selector)}}(jQuery);
    88        /* jshint ignore:end */
    99    }
  • trunk/src/wp-includes/js/hoverIntent.js

    r24259 r31723  
    11/*!
    2  * hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+
     2 * hoverIntent v1.8.1 // 2014.08.11 // jQuery v1.9.1+
    33 * http://cherne.net/brian/resources/jquery.hoverIntent.html
    44 *
    55 * You may use hoverIntent under the terms of the MIT license. Basically that
    66 * means you are free to use hoverIntent as long as this header is left intact.
    7  * Copyright 2007, 2013 Brian Cherne
     7 * Copyright 2007, 2014 Brian Cherne
    88 */
    99
     
    3636        var cfg = {
    3737            interval: 100,
    38             sensitivity: 7,
     38            sensitivity: 6,
    3939            timeout: 0
    4040        };
     
    6363            ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
    6464            // compare mouse positions to see if they've crossed the threshold
    65             if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
     65            if ( Math.sqrt( (pX-cX)*(pX-cX) + (pY-cY)*(pY-cY) ) < cfg.sensitivity ) {
    6666                $(ob).off("mousemove.hoverIntent",track);
    6767                // set hoverIntent state to true (so mouseOut can be called)
    68                 ob.hoverIntent_s = 1;
     68                ob.hoverIntent_s = true;
    6969                return cfg.over.apply(ob,[ev]);
    7070            } else {
     
    7979        var delay = function(ev,ob) {
    8080            ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
    81             ob.hoverIntent_s = 0;
     81            ob.hoverIntent_s = false;
    8282            return cfg.out.apply(ob,[ev]);
    8383        };
     
    8686        var handleHover = function(e) {
    8787            // copy objects to be passed into t (required for event object to be passed in IE)
    88             var ev = jQuery.extend({},e);
     88            var ev = $.extend({},e);
    8989            var ob = this;
    9090
     
    9292            if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
    9393
    94             // if e.type == "mouseenter"
    95             if (e.type == "mouseenter") {
     94            // if e.type === "mouseenter"
     95            if (e.type === "mouseenter") {
    9696                // set "previous" X and Y position based on initial entry point
    9797                pX = ev.pageX; pY = ev.pageY;
     
    9999                $(ob).on("mousemove.hoverIntent",track);
    100100                // start polling interval (self-calling timeout) to compare mouse coordinates over time
    101                 if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
     101                if (!ob.hoverIntent_s) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
    102102
    103103                // else e.type == "mouseleave"
     
    106106                $(ob).off("mousemove.hoverIntent",track);
    107107                // if hoverIntent state is true, then call the mouseOut function after the specified delay
    108                 if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
     108                if (ob.hoverIntent_s) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
    109109            }
    110110        };
  • trunk/src/wp-includes/script-loader.php

    r31716 r31723  
    381381    $scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox', 'shortcode' ), false, 1 );
    382382
    383     $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), 'r7', 1 );
     383    $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '1.8.1', 1 );
    384384
    385385    $scripts->add( 'customize-base',     "/wp-includes/js/customize-base$suffix.js",     array( 'jquery', 'json2', 'underscore', 'wp-a11y' ), false, 1 );
Note: See TracChangeset for help on using the changeset viewer.