Gergő Tisza has uploaded a new change for review.

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

Change subject: Remove delay when logging link clicks
......................................................................

Remove delay when logging link clicks

EventLogging uses sendBeacon now so there is no danger of losing
clicks because the browser navigates away. (On modern browsers,
anyway; but we can live with being a little imprecise on older
browsers. We don't use link click stats much, anyway.)

Bug: T89533
Change-Id: Id83f60585d11f06610d8514c211f0116c60ea936
---
M resources/mmv/ui/mmv.ui.js
1 file changed, 2 insertions(+), 18 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer 
refs/changes/05/190705/1

diff --git a/resources/mmv/ui/mmv.ui.js b/resources/mmv/ui/mmv.ui.js
index 4a97213..e948391 100644
--- a/resources/mmv/ui/mmv.ui.js
+++ b/resources/mmv/ui/mmv.ui.js
@@ -198,25 +198,9 @@
        /**
         * Tracks a click on a link and lets the user navigate to it
         * @param {string} action The action label to log.
-        * @param {jQuery.Event} e Click event object
         */
-       EP.trackLinkClick = function ( action, e ) {
-               var $link = $( this );
-
-               if ( e.altKey || e.shiftKey || e.ctrlKey || e.metaKey || 
e.button === 1 ) {
-                       // They are likely opening the link in a new window or 
tab
-                       mw.mmv.actionLogger.log( action );
-                       return;
-               }
-
-               // If it's a plain click, we need to wait for the logging to
-               // be done before navigating to the desired page
-               e.preventDefault();
-
-               // We want to redirect anyway, whether logging worked or not
-               mw.mmv.actionLogger.log( action ).always( function () {
-                       window.location.href = $link.prop( 'href' );
-               } );
+       EP.trackLinkClick = function ( action ) {
+               mw.mmv.actionLogger.log( action );
        };
 
        /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id83f60585d11f06610d8514c211f0116c60ea936
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: GergÅ‘ Tisza <[email protected]>

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

Reply via email to