mediawiki-extensions-Multim.../resources/multilightbox/multilightbox.js
Gilles Dubuc 35690bb2f1 Get rid of lightboxHooks
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
2014-02-13 17:47:30 -08:00

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;
}() );