Jdlrobson has uploaded a new change for review.

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

Change subject: Minor refactor - use named function for wikipage.content hook
......................................................................

Minor refactor - use named function for wikipage.content hook

The handler for the hook `wikipage.content` was long
and undocumented but is a crucial piece of code.

To make it a little easier for people not so familiar with the code
to find this code and understand what it does I've pulled it out into
a named function.

Change-Id: I3ada53e135dea7dc6846440999b0d42285e14013
---
M resources/ext.popups.targets/desktopTarget.js
1 file changed, 12 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Popups 
refs/changes/95/311595/1

diff --git a/resources/ext.popups.targets/desktopTarget.js 
b/resources/ext.popups.targets/desktopTarget.js
index 0de142c..3bd524e 100644
--- a/resources/ext.popups.targets/desktopTarget.js
+++ b/resources/ext.popups.targets/desktopTarget.js
@@ -124,7 +124,15 @@
                } );
        };
 
-       mw.hook( 'wikipage.content' ).add( function ( $content ) {
+       /**
+        * Adds the events necessary to all links within a container
+        * so that a popup shows on hover.
+        *
+        * @param {jQuery.Object} $content to setup mouse events for
+        * @ignore
+        * @method checkScroll
+        */
+       function setupMouseEvents( $content ) {
                var $elements, dwellStartTime, linkInteractionToken;
 
                mw.popups.$content = $content;
@@ -163,7 +171,9 @@
                                        }, onLinkClick );
                        }
                } );
-       } );
+       }
+
+       mw.hook( 'wikipage.content' ).add( setupMouseEvents );
 
        function initPopups() {
                mw.popups.checkScroll();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3ada53e135dea7dc6846440999b0d42285e14013
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Popups
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>

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

Reply via email to