MarkTraceur has uploaded a new change for review.
https://gerrit.wikimedia.org/r/99722
Change subject: Move clearInterface things to mw.LightboxInterface
......................................................................
Move clearInterface things to mw.LightboxInterface
Also fixes a bug where we didn't clear our arrow key listeners, and VE
would sometimes see lightbox loads accidentally.
Change-Id: Ica8326891b2da1f94966dbe72c28e878934ca64f
---
M resources/ext.multimediaViewer/ext.multimediaViewer.js
M resources/ext.multimediaViewer/ext.multimediaViewer.lightboxinterface.js
2 files changed, 37 insertions(+), 29 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer
refs/changes/22/99722/1
diff --git a/resources/ext.multimediaViewer/ext.multimediaViewer.js
b/resources/ext.multimediaViewer/ext.multimediaViewer.js
index f58c1b4..4812cc0 100755
--- a/resources/ext.multimediaViewer/ext.multimediaViewer.js
+++ b/resources/ext.multimediaViewer/ext.multimediaViewer.js
@@ -166,32 +166,6 @@
this.$imageMetadata.show();
}
} );
-
- lightboxHooks.register( 'clearInterface', function () {
- this.$license.empty().addClass( 'empty' );
-
- this.$imageDesc.empty();
- this.$imageDescDiv.addClass( 'empty' );
- this.$title.empty();
- this.$credit.empty().addClass( 'empty' );
-
- this.$username.empty();
- this.$usernameLi.addClass( 'empty' );
-
- this.$repo.empty();
- this.$repoLi.addClass( 'empty' );
-
- this.$datetime.empty();
- this.$datetimeLi.addClass( 'empty' );
-
- this.$useFile.data( 'title', null );
- this.$useFile.data( 'link', null );
- this.$useFile.data( 'src', null );
- this.$useFile.data( 'isLocal', null );
- this.$useFileLi.addClass( 'empty' );
-
- this.$imageDiv.addClass( 'empty' );
- } );
}
MMVP = MultimediaViewer.prototype;
diff --git
a/resources/ext.multimediaViewer/ext.multimediaViewer.lightboxinterface.js
b/resources/ext.multimediaViewer/ext.multimediaViewer.lightboxinterface.js
index 7c132c5..059ad44 100644
--- a/resources/ext.multimediaViewer/ext.multimediaViewer.lightboxinterface.js
+++ b/resources/ext.multimediaViewer/ext.multimediaViewer.lightboxinterface.js
@@ -28,6 +28,40 @@
LIP = LightboxInterface.prototype;
+ LIP.empty = function () {
+ if ( this.handleKeyDown ) {
+ // Clear events on document
+ $( document ).off( 'keydown', this.handleKeyDown );
+ this.handleKeyDown = undefined;
+ }
+
+ this.$license.empty().addClass( 'empty' );
+
+ this.$imageDesc.empty();
+ this.$imageDescDiv.addClass( 'empty' );
+ this.$title.empty();
+ this.$credit.empty().addClass( 'empty' );
+
+ this.$username.empty();
+ this.$usernameLi.addClass( 'empty' );
+
+ this.$repo.empty();
+ this.$repoLi.addClass( 'empty' );
+
+ this.$datetime.empty();
+ this.$datetimeLi.addClass( 'empty' );
+
+ this.$useFile.data( 'title', null );
+ this.$useFile.data( 'link', null );
+ this.$useFile.data( 'src', null );
+ this.$useFile.data( 'isLocal', null );
+ this.$useFileLi.addClass( 'empty' );
+
+ this.$imageDiv.addClass( 'empty' );
+
+ MLBInterface.prototype.empty.call( this );
+ };
+
LIP.load = function ( image ) {
var hashFragment = '#mediaviewer/' +
mw.mediaViewer.currentImageFilename + '/' +
mw.mediaViewer.lightbox.currentIndex;
@@ -348,7 +382,7 @@
};
LIP.initializeNavigation = function () {
- function handleKeyDown( e ) {
+ this.handleKeyDown = this.handleKeyDown || function ( e ) {
var isRtl = $( document.body ).hasClass( 'rtl' );
switch ( e.keyCode ) {
@@ -369,7 +403,7 @@
}
break;
}
- }
+ };
this.$nextButton = $( '<div>' )
.addClass( 'mw-mlb-next-image disabled' )
@@ -387,7 +421,7 @@
} )
.appendTo( this.$main );
- $( document ).off( 'keydown', handleKeyDown ).on( 'keydown',
handleKeyDown );
+ $( document ).off( 'keydown', this.handleKeyDown ).on(
'keydown', this.handleKeyDown );
};
window.LightboxInterface = LightboxInterface;
--
To view, visit https://gerrit.wikimedia.org/r/99722
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica8326891b2da1f94966dbe72c28e878934ca64f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits