From 2dc258b3093e204f2ab7eb5416c75806114c3072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Tisza?= Date: Mon, 31 Mar 2014 18:19:00 +0000 Subject: [PATCH] Remove the temporary click handler once the final one is installed Change-Id: I166ab85e358c74db486709ca062897c8cf541cfa Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/391 --- resources/mmv/mmv.bootstrap.js | 3 +++ resources/mmv/mmv.head.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/mmv/mmv.bootstrap.js b/resources/mmv/mmv.bootstrap.js index 9993db659..4dddcc1ce 100755 --- a/resources/mmv/mmv.bootstrap.js +++ b/resources/mmv/mmv.bootstrap.js @@ -168,6 +168,9 @@ $link.add( $enlarge ).click( function ( e ) { return bs.click( this, e, title ); } ); + // now that we have set up our real click handler we can we can remove the temporary + // handler added in mmv.head.js which just replays clicks to the real handler + $( document ).off( 'click.mmv-head' ); this.thumbsReadyDeferred.resolve(); }; diff --git a/resources/mmv/mmv.head.js b/resources/mmv/mmv.head.js index 7d43cffbb..69c02f3e1 100644 --- a/resources/mmv/mmv.head.js +++ b/resources/mmv/mmv.head.js @@ -24,7 +24,7 @@ return; } - $document.on( 'click', 'a.image', function ( e ) { + $document.on( 'click.mmv-head', 'a.image', function ( e ) { // Do not interfere with non-left clicks or if modifier keys are pressed. // Also, make sure we do not get in a loop. if ( ( e.which !== 0 && e.which !== 1 ) || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey || e.replayed ) {