PluginProbe
Photonic Gallery & Lightbox for Flickr, SmugMug & Others / 2.41
Photonic Gallery & Lightbox for Flickr, SmugMug & Others v2.41
3.36 3.35 3.34 3.33 2.19 2.20 2.21 2.22 2.23 2.24 2.25 2.26 2.27 2.28 2.29 2.30 2.31 2.32 2.33 2.34 2.40 2.41 2.42 2.43 2.44 All 141 releases
photonic / include / scripts / front-end / src / lightboxes / Lightbox_ImageLightbox.js

Lightbox_ImageLightbox.js in Photonic Gallery & Lightbox for Flickr, SmugMug & Others 2.41, at include/scripts/front-end/src/lightboxes/Lightbox_ImageLightbox.js

73 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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