Paladox has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/184140

Change subject: Update jquery.hoverIntent to 1.8.1
......................................................................

Update jquery.hoverIntent to 1.8.1

Project site

* http://cherne.net/brian/resources/jquery.hoverIntent.html

File source

* 
https://github.com/briancherne/jquery-hoverIntent/blob/v1.8.1/jquery.hoverIntent.js

Requires jQuery 1.9.1+

Changes between r 5 and 1.8.1 are

No difference between 1.8.0 and 1.8.1 except from version.

* v1.8.0 = (2014) Changed to Semantic Versioning (from r 8 to v1.8.0).

* r 7 = (2013) Added event delegation via "selector" param/property.
  Added namespaced events for better isolation. Added handlerInOut support.

* r 6 = (2011) Identical to r5 except that the Google Chrome defect is
  fixed once you upgrade to jQuery 1.5.1 (or later).

Upgrading from r 5 to 1.8.1. r5 is from 2007 and 1.8.1 is from 2014.

Change-Id: Ieb014f15566d58fcecff0655549bc1049bacd02f
---
M RELEASE-NOTES-1.25
M includes/api/i18n/en.json
M resources/lib/jquery/jquery.hoverIntent.js
3 files changed, 59 insertions(+), 54 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/40/184140/1

diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25
index 2aa066c..93f830d 100644
--- a/RELEASE-NOTES-1.25
+++ b/RELEASE-NOTES-1.25
@@ -80,6 +80,7 @@
   they will add the proper credits to the skins or extensions section.
 * Update QUnit from v1.14.0 to v1.16.0.
 * Update Moment.js from v2.8.3 to v2.8.4.
+* Upgrade jQuery hoverIntent to v1.8.0.
 
 ==== External libraries ====
 * MediaWiki now requires certain external libraries to be installed. In the 
past
diff --git a/includes/api/i18n/en.json b/includes/api/i18n/en.json
index 0eed4cd..cba687b 100644
--- a/includes/api/i18n/en.json
+++ b/includes/api/i18n/en.json
@@ -83,7 +83,7 @@
        "apihelp-edit-param-bot": "Mark this edit as bot.",
        "apihelp-edit-param-basetimestamp": "Timestamp of the base revision, 
used to detect edit conflicts. May be obtained through 
[[Special:ApiHelp/query+revisions|action=query&prop=revisions&rvprop=timestamp]].",
        "apihelp-edit-param-starttimestamp": "Timestamp when you began the 
editing process, used to detect edit conflicts. An appropriate value may be 
obtained using [[Special:ApiHelp/main|curtimestamp]] when beginning the edit 
process (e.g. when loading the page content to edit).",
-       "apihelp-edit-param-recreate": "Override any errors about the article 
having been deleted in the meantime.",
+       "apihelp-edit-param-recreate": "Override any errors about the page 
having been deleted in the meantime.",
        "apihelp-edit-param-createonly": "Don't edit the page if it exists 
already.",
        "apihelp-edit-param-nocreate": "Throw an error if the page doesn't 
exist.",
        "apihelp-edit-param-watch": "Add the page to your watchlist.",
diff --git a/resources/lib/jquery/jquery.hoverIntent.js 
b/resources/lib/jquery/jquery.hoverIntent.js
index adf948d..2f0fa51 100644
--- a/resources/lib/jquery/jquery.hoverIntent.js
+++ b/resources/lib/jquery/jquery.hoverIntent.js
@@ -1,42 +1,51 @@
-/**
-* hoverIntent is similar to jQuery's built-in "hover" function except that
-* instead of firing the onMouseOver event immediately, hoverIntent checks
-* to see if the user's mouse has slowed down (beneath the sensitivity
-* threshold) before firing the onMouseOver event.
-* 
-* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
-* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
-* 
-* hoverIntent is currently available for use in all personal or commercial 
-* projects under both MIT and GPL licenses. This means that you can choose 
-* the license that best suits your project, and use it accordingly.
-* 
-* // basic usage (just like .hover) receives onMouseOver and onMouseOut 
functions
-* $("ul li").hoverIntent( showNav , hideNav );
-* 
-* // advanced usage receives configuration object only
-* $("ul li").hoverIntent({
-*      sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
-*      interval: 100,   // number = milliseconds of polling interval
-*      over: showNav,  // function = onMouseOver callback (required)
-*      timeout: 0,   // number = milliseconds delay before onMouseOut function 
call
-*      out: hideNav    // function = onMouseOut callback (required)
-* });
-* 
-* @param  f  onMouseOver function || An object with configuration options
-* @param  g  onMouseOut function  || Nothing (use configuration options object)
-* @author    Brian Cherne <br...@cherne.net>
-*/
+/*!
+ * hoverIntent v1.8.1 // 2014.08.11 // jQuery v1.9.1+
+ * http://cherne.net/brian/resources/jquery.hoverIntent.html
+ *
+ * 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
+ */
+ 
+/* 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
+ * called after a matching handlerIn.
+ *
+ * // basic usage ... just like .hover()
+ * .hoverIntent( handlerIn, handlerOut )
+ * .hoverIntent( handlerInOut )
+ *
+ * // basic usage ... with event delegation!
+ * .hoverIntent( handlerIn, handlerOut, selector )
+ * .hoverIntent( handlerInOut, selector )
+ *
+ * // using a basic configuration object
+ * .hoverIntent( config )
+ *
+ * @param  handlerIn   function OR configuration object
+ * @param  handlerOut  function OR selector for delegation OR undefined
+ * @param  selector    selector OR undefined
+ * @author Brian Cherne <brian(at)cherne(dot)net>
+ */
 (function($) {
-       $.fn.hoverIntent = function(f,g) {
-               // default configuration options
+       $.fn.hoverIntent = function(handlerIn,handlerOut,selector) {
+
+               // default configuration values
                var cfg = {
-                       sensitivity: 7,
                        interval: 100,
+                       sensitivity: 6,
                        timeout: 0
                };
-               // override configuration options with user supplied object
-               cfg = $.extend(cfg, g ? { over: f, out: g } : f );
+
+               if ( typeof handlerIn === "object" ) {
+                       cfg = $.extend(cfg, handlerIn );
+               } 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
@@ -53,10 +62,10 @@
                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.abs(pX-cX) + Math.abs(pY-cY) ) < 
cfg.sensitivity ) {
-                               $(ob).unbind("mousemove",track);
+                       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 = 1;
+                               ob.hoverIntent_s = true;
                                return cfg.over.apply(ob,[ev]);
                        } else {
                                // set previous coordinates for next time
@@ -69,17 +78,12 @@
                // A private function for delaying the mouseOut function
                var delay = function(ev,ob) {
                        ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
-                       ob.hoverIntent_s = 0;
+                       ob.hoverIntent_s = false;
                        return cfg.out.apply(ob,[ev]);
                };
 
                // A private function for handling mouse 'hovering'
                var handleHover = function(e) {
-                       // next three lines copied from jQuery.hover, ignore 
children onMouseOver/onMouseOut
-                       var p = (e.type == "mouseover" ? e.fromElement : 
e.toElement) || e.relatedTarget;
-                       while ( p && p != this ) { try { p = p.parentNode; } 
catch(e) { p = this; } }
-                       if ( p == this ) { return false; }
-
                        // copy objects to be passed into t (required for event 
object to be passed in IE)
                        var ev = $.extend({},e);
                        var ob = this;
@@ -87,25 +91,25 @@
                        // cancel hoverIntent timer if it exists
                        if (ob.hoverIntent_t) { ob.hoverIntent_t = 
clearTimeout(ob.hoverIntent_t); }
 
-                       // else e.type == "onmouseover"
-                       if (e.type == "mouseover") {
+                       // if e.type === "mouseenter"
+                       if (e.type === "mouseenter") {
                                // set "previous" X and Y position based on 
initial entry point
                                pX = ev.pageX; pY = ev.pageY;
                                // update "current" X and Y position based on 
mousemove
-                               $(ob).bind("mousemove",track);
+                               $(ob).on("mousemove.hoverIntent",track);
                                // start polling interval (self-calling 
timeout) to compare mouse coordinates over time
-                               if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = 
setTimeout( function(){compare(ev,ob);} , cfg.interval );}
+                               if (!ob.hoverIntent_s) { ob.hoverIntent_t = 
setTimeout( function(){compare(ev,ob);} , cfg.interval );}
 
-                       // else e.type == "onmouseout"
+                               // else e.type == "mouseleave"
                        } else {
                                // unbind expensive mousemove event
-                               $(ob).unbind("mousemove",track);
+                               $(ob).off("mousemove.hoverIntent",track);
                                // if hoverIntent state is true, then call the 
mouseOut function after the specified delay
-                               if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = 
setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
+                               if (ob.hoverIntent_s) { ob.hoverIntent_t = 
setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
                        }
                };
 
-               // bind the function to the two event listeners
-               return this.mouseover(handleHover).mouseout(handleHover);
+               // listen for mouseenter and mouseleave
+               return 
this.on({'mouseenter.hoverIntent':handleHover,'mouseleave.hoverIntent':handleHover},
 cfg.selector);
        };
-})(jQuery);
\ No newline at end of file
+})(jQuery);

-- 
To view, visit https://gerrit.wikimedia.org/r/184140
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieb014f15566d58fcecff0655549bc1049bacd02f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Paladox <thomasmulhall...@yahoo.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to