From e8479a070d389a3b9bd4aaa1ab6fc5bf4bc640fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Laxstr=C3=B6m?= Date: Thu, 1 Aug 2013 15:33:12 +0000 Subject: [PATCH] Log ui-lang-revert Change-Id: Ic48dbd7a9d4d43812f437e3c9f17d1ee208166e8 --- resources/js/ext.uls.interface.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/resources/js/ext.uls.interface.js b/resources/js/ext.uls.interface.js index 0a1cb286..1ac9bb1b 100644 --- a/resources/js/ext.uls.interface.js +++ b/resources/js/ext.uls.interface.js @@ -239,9 +239,16 @@ hideTipsy(); }, timeout ); } ); - // Event handler for links in the tooltip - $( 'a.uls-prevlang-link' ).on( 'click', function () { - mw.uls.changeLanguage( $( this ).attr( 'lang' ) ); + + // Event handler for links in the tooltip. + // It looks like the tipsy is always created from scratch so that + // there wont be multiple event handlers bound to same click. + $( 'a.uls-prevlang-link' ).on( 'click.ulstipsy', function ( event ) { + event.preventDefault(); + mw.uls.logEvent( { action: 'ui-lang-revert' }, 500 ) + .always( function () { + mw.uls.changeLanguage( event.target.lang ); + } ); } ); tipsyTimer = window.setTimeout( function () { hideTipsy();