mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-17 12:53:24 +00:00
35690bb2f1
Delete lightboxHooks, since most of them haven't proven to be useful. Replace the useful ones by jQuery events. Change-Id: I28f99ba85666ca15979feb5c637924b98bba27a8 Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/176
55 lines
1.2 KiB
JavaScript
55 lines
1.2 KiB
JavaScript
( function () {
|
|
var MLBP;
|
|
|
|
/**
|
|
* @class mlb.MultiLightbox
|
|
* @constructor
|
|
* @param {mlb.LightboxImage[]} images
|
|
* @param {number} [start=0]
|
|
* @param {Function} [InterfaceClass] type of interface to use
|
|
*/
|
|
function MultiLightbox( images, start, InterfaceClass ) {
|
|
this.images = images;
|
|
this.currentIndex = start || 0;
|
|
this.onInterfaceReady = [];
|
|
this.initializeInterface( InterfaceClass );
|
|
this.interfaceReady();
|
|
}
|
|
|
|
MLBP = MultiLightbox.prototype;
|
|
|
|
/**
|
|
* Instantiates and initializes the interface object
|
|
* @param {Function} [InterfaceClass] type of interface to use
|
|
*/
|
|
MLBP.initializeInterface = function ( InterfaceClass ) {
|
|
InterfaceClass = InterfaceClass || window.LightboxInterface;
|
|
this.iface = new InterfaceClass();
|
|
};
|
|
|
|
MLBP.onInterface = function ( func ) {
|
|
if ( this.onInterfaceReady !== undefined ) {
|
|
this.onInterfaceReady.push( func );
|
|
} else {
|
|
func();
|
|
}
|
|
};
|
|
|
|
MLBP.interfaceReady = function () {
|
|
var i;
|
|
|
|
for ( i = 0; i < this.onInterfaceReady.length; i++ ) {
|
|
this.onInterfaceReady[i]();
|
|
}
|
|
|
|
this.onInterfaceReady = undefined;
|
|
};
|
|
|
|
MLBP.open = function () {
|
|
this.iface.empty();
|
|
this.iface.attach();
|
|
};
|
|
|
|
window.MultiLightbox = MultiLightbox;
|
|
}() );
|