Bmansurov has uploaded a new change for review.

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

Change subject: Do not log the click event multiple times
......................................................................

Do not log the click event multiple times

When hovercards are off clicking of a link will log the click
event as many times as you hovered over the link prior to clicking.
To prevent this, stop listening to old events before listening to
new ones.

Bug: T143805
Change-Id: I3e0dd2d1f259cdadfd3e02c67a137697540ca955
---
M resources/ext.popups.targets/desktopTarget.js
1 file changed, 3 insertions(+), 2 deletions(-)


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

diff --git a/resources/ext.popups.targets/desktopTarget.js 
b/resources/ext.popups.targets/desktopTarget.js
index db05b3a..8be26f9 100644
--- a/resources/ext.popups.targets/desktopTarget.js
+++ b/resources/ext.popups.targets/desktopTarget.js
@@ -147,15 +147,16 @@
                                linkInteractionToken = 
mw.popups.getRandomToken();
 
                                $link
+                                       .off( 'mouseleave.popups blur.popups 
click.popups' )
                                        // We are passing the same data, rather 
than a shared object, into two different functions.
                                        // The reason is that we don't want one 
function to change the data and
                                        // have a side-effect on the other 
function's data.
-                                       .on( 'mouseleave blur', {
+                                       .on( 'mouseleave.popups blur.popups', {
                                                dwellStartTime: dwellStartTime,
                                                linkInteractionToken: 
linkInteractionToken,
                                                hovercardsSuppressedByGadget: 
isNavigationPopupsGadgetEnabled()
                                        }, onLinkAbandon )
-                                       .on( 'click', {
+                                       .on( 'click.popups', {
                                                dwellStartTime: dwellStartTime,
                                                linkInteractionToken: 
linkInteractionToken,
                                                hovercardsSuppressedByGadget: 
isNavigationPopupsGadgetEnabled()

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e0dd2d1f259cdadfd3e02c67a137697540ca955
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Popups
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to