| 1 |
function Photonic_Lightbox_ImageLightbox() { |
| 2 |
Photonic_Lightbox.call(this); |
| 3 |
} |
| 4 |
Photonic_Lightbox_ImageLightbox.prototype = Object.create(Photonic_Lightbox.prototype); |
| 5 |
|
| 6 |
Photonic_Lightbox_ImageLightbox.prototype.soloImages = function() { |
| 7 |
$('a[href]').filter(function() { |
| 8 |
return /(\.jpg|\.jpeg|\.bmp|\.gif|\.png)/i.test( $(this).attr('href')); |
| 9 |
}).filter(function() { |
| 10 |
var res = new RegExp('photonic-launch-gallery').test($(this).attr('class')); |
| 11 |
return !res; |
| 12 |
}).attr("rel", 'photonic-' + Photonic_JS.slideshow_library); |
| 13 |
}; |
| 14 |
|
| 15 |
Photonic_Lightbox_ImageLightbox.prototype.initialize = function(selector, group) { |
| 16 |
this.handleSolos(); |
| 17 |
var self = this; |
| 18 |
|
| 19 |
$(selector).each(function() { |
| 20 |
var current = this; |
| 21 |
var lightbox_selector; |
| 22 |
var rel = $(current).find('a.launch-gallery-imagelightbox'); |
| 23 |
if (rel.length > 0) { |
| 24 |
rel = $(rel[0]).attr('rel'); |
| 25 |
} |
| 26 |
|
| 27 |
lightbox_selector = selector.indexOf('rel') > -1 ? selector : 'a[rel="' + rel + '"]'; |
| 28 |
|
| 29 |
var photonicImageLightbox = $(lightbox_selector).imageLightbox({ |
| 30 |
onLoadStart: function() { |
| 31 |
imageLightboxCaptionOff(); |
| 32 |
imageLightboxLoadingOn(); |
| 33 |
}, |
| 34 |
onLoadEnd: function() { |
| 35 |
imageLightboxCaptionOn(); |
| 36 |
$('#imagelightbox-loading').remove(); |
| 37 |
$( '.imagelightbox-arrow' ).css( 'display', 'block' ); |
| 38 |
var lightbox = $('#imagelightbox'); |
| 39 |
var base = $(current).find('a[href="' + lightbox.attr('src') + '"]'); |
| 40 |
self.setHash(base); |
| 41 |
var shareable = { |
| 42 |
'url': location.href, |
| 43 |
'title': photonicHtmlDecode($(base).data('title')), |
| 44 |
'image': lightbox.attr('src') |
| 45 |
}; |
| 46 |
self.addSocial('#imagelightbox-overlay', shareable); |
| 47 |
}, |
| 48 |
onStart: function() { |
| 49 |
$('<div id="imagelightbox-overlay"></div>').appendTo('body'); |
| 50 |
imageLightboxArrowsOn(photonicImageLightbox, lightbox_selector); |
| 51 |
imageLightboxCloseButtonOn(photonicImageLightbox); |
| 52 |
}, |
| 53 |
onEnd: function() { |
| 54 |
imageLightboxCaptionOff(); |
| 55 |
$('#imagelightbox-overlay').remove(); |
| 56 |
$('#imagelightbox-loading').remove(); |
| 57 |
imageLightboxArrowsOff(); |
| 58 |
imageLightboxCloseButtonOff(); |
| 59 |
self.unsetHash(); |
| 60 |
} |
| 61 |
}); |
| 62 |
photonicLightboxList[lightbox_selector] = photonicImageLightbox; |
| 63 |
}); |
| 64 |
}; |
| 65 |
|
| 66 |
Photonic_Lightbox_ImageLightbox.prototype.initializeForNewContainer = function(containerId) { |
| 67 |
this.initialize(containerId); |
| 68 |
}; |
| 69 |
|
| 70 |
photonicLightbox = new Photonic_Lightbox_ImageLightbox(); |
| 71 |
photonicLightbox.initialize('.photonic-standard-layout,.photonic-random-layout,.photonic-masonry-layout,.photonic-mosaic-layout'); |
| 72 |
photonicLightbox.initialize('a[rel="photonic-imagelightbox"]'); |
| 73 |
|