2013-11-25 23:51:40 +00:00
|
|
|
( function () {
|
2014-02-11 13:25:39 +00:00
|
|
|
var MLBP;
|
2013-08-07 08:59:08 +00:00
|
|
|
|
|
|
|
/**
|
2014-02-03 23:20:54 +00:00
|
|
|
* @class mlb.MultiLightbox
|
2013-08-07 08:59:08 +00:00
|
|
|
* @constructor
|
2014-02-03 23:20:54 +00:00
|
|
|
* @param {mlb.LightboxImage[]} images
|
2013-08-07 08:59:08 +00:00
|
|
|
* @param {number} [start=0]
|
2013-12-11 02:08:07 +00:00
|
|
|
* @param {Function} [InterfaceClass] type of interface to use
|
2013-08-07 08:59:08 +00:00
|
|
|
*/
|
2013-12-11 02:08:07 +00:00
|
|
|
function MultiLightbox( images, start, InterfaceClass ) {
|
2013-08-07 08:59:08 +00:00
|
|
|
this.images = images;
|
|
|
|
this.currentIndex = start || 0;
|
|
|
|
this.onInterfaceReady = [];
|
2014-01-06 21:53:42 +00:00
|
|
|
this.initializeInterface( InterfaceClass );
|
|
|
|
this.interfaceReady();
|
2013-08-07 08:59:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MLBP = MultiLightbox.prototype;
|
|
|
|
|
2014-01-06 21:53:42 +00:00
|
|
|
/**
|
|
|
|
* 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();
|
|
|
|
};
|
|
|
|
|
2013-08-07 08:59:08 +00:00
|
|
|
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 () {
|
2013-10-23 23:51:34 +00:00
|
|
|
this.iface.empty();
|
2013-08-07 08:59:08 +00:00
|
|
|
this.iface.attach();
|
|
|
|
};
|
|
|
|
|
|
|
|
window.MultiLightbox = MultiLightbox;
|
2013-11-25 23:51:40 +00:00
|
|
|
}() );
|