mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-09-25 03:09:40 +00:00
Fix runaway prev/next issue
Prev/next handlers were multiplying after every click. Change-Id: I1e21b2711cc08a6edbbd26ec844e966f7582b3c8
This commit is contained in:
parent
cc9e2daf2f
commit
f4ab39df1e
|
@ -189,6 +189,8 @@
|
|||
viewer.resize( ui );
|
||||
return false;
|
||||
} );
|
||||
|
||||
this.setupEventHandlers();
|
||||
}
|
||||
|
||||
MMVP = MultimediaViewer.prototype;
|
||||
|
@ -347,14 +349,6 @@
|
|||
this.lightbox.iface.load( image );
|
||||
}
|
||||
|
||||
this.lightbox.iface.$imageWrapper.on( 'mmv-next', function () {
|
||||
viewer.nextImage();
|
||||
} );
|
||||
|
||||
this.lightbox.iface.$imageWrapper.on( 'mmv-prev', function () {
|
||||
viewer.prevImage();
|
||||
} );
|
||||
|
||||
$( document.body ).addClass( 'mw-mlb-lightbox-open' );
|
||||
|
||||
imageWidths = this.ui.getImageSizeApiArgs();
|
||||
|
@ -486,6 +480,18 @@
|
|||
this.loadIndex( this.lightbox.currentIndex - 1 );
|
||||
};
|
||||
|
||||
MMVP.setupEventHandlers = function() {
|
||||
var viewer = this;
|
||||
|
||||
this.lightbox.iface.$imageWrapper.on( 'mmv-next', function () {
|
||||
viewer.nextImage();
|
||||
} );
|
||||
|
||||
this.lightbox.iface.$imageWrapper.on( 'mmv-prev', function () {
|
||||
viewer.prevImage();
|
||||
} );
|
||||
};
|
||||
|
||||
function handleHash() {
|
||||
var statedIndex,
|
||||
$foundElement,
|
||||
|
|
Loading…
Reference in a new issue