Gergő Tisza has uploaded a new change for review.

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

Change subject: Do not handle clicks if MediaViewer could not be loaded.
......................................................................

Do not handle clicks if MediaViewer could not be loaded.

mmv.bootstrap will not try again to handle clicks if it failed
for the first time.

Change-Id: Idd55d7dc6c1388070895f8630bdcd51763a94d86
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/527
Bug: 63801
---
M resources/mmv/mmv.bootstrap.js
1 file changed, 12 insertions(+), 0 deletions(-)


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

diff --git a/resources/mmv/mmv.bootstrap.js b/resources/mmv/mmv.bootstrap.js
index 007617f..bcf6abf 100755
--- a/resources/mmv/mmv.bootstrap.js
+++ b/resources/mmv/mmv.bootstrap.js
@@ -41,6 +41,12 @@
                /** @property {mw.mmv.HtmlUtils} htmlUtils - */
                this.htmlUtils = new mw.mmv.HtmlUtils();
 
+               /**
+                * This flag is set to true when we were unable to load the 
viewer.
+                * @property {boolean}
+                */
+               this.viewerIsBroken = false;
+
                this.thumbsReadyDeferred = $.Deferred();
                this.thumbs = [];
                this.$thumbs = $( '.gallery .image img, a.image img, #file a 
img' );
@@ -83,6 +89,7 @@
                } ).fail( function( message ) {
                        mw.log.warn( message );
                        bs.cleanupOverlay();
+                       bs.viewerIsBroken = true;
                        mw.notify( 'Error loading MediaViewer: ' + message );
                } );
        };
@@ -236,6 +243,11 @@
                        return;
                }
 
+               // Don't load if we already tried loading and it failed
+               if ( this.viewerIsBroken ) {
+                       return;
+               }
+
                if ( $element.is( 'a.image' ) ) {
                        mw.mmv.logger.log( 'thumbnail' );
                } else if ( $element.is( '.magnify a' ) ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idd55d7dc6c1388070895f8630bdcd51763a94d86
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