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_Fancybox3.js

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

101 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 function Photonic_Lightbox_Fancybox3() {
2 Photonic_Lightbox.call(this);
3
4 this.buttons = [];
5 if (Photonic_JS.fb3_zoom) {
6 this.buttons.push('zoom');
7 }
8 if (Photonic_JS.fb3_slideshow) {
9 this.buttons.push('slideShow');
10 }
11 if (Photonic_JS.fb3_fullscreen_button) {
12 this.buttons.push('fullScreen');
13 }
14 if (Photonic_JS.fb3_download) {
15 this.buttons.push('download');
16 }
17 if (Photonic_JS.fb3_thumbs_button) {
18 this.buttons.push('thumbs');
19 }
20 this.buttons.push('close');
21 }
22 Photonic_Lightbox_Fancybox3.prototype = Object.create(Photonic_Lightbox.prototype);
23
24 Photonic_Lightbox_Fancybox3.prototype.soloImages = function() {
25 $('a[href]').filter(function() {
26 return /(\.jpg|\.jpeg|\.bmp|\.gif|\.png)/i.test( $(this).attr('href'));
27 }).addClass("launch-gallery-fancybox").addClass(Photonic_JS.slideshow_library);
28 };
29
30 Photonic_Lightbox_Fancybox3.prototype.initialize = function(selector, group) {
31 this.handleSolos();
32 var self = this;
33
34 var lightbox_selector;
35 if (group !== null && group !== undefined) {
36 lightbox_selector = 'a[data-fancybox="' + group + '"]';
37 }
38 else if (selector !== null && selector !== undefined) {
39 lightbox_selector = selector + ' a.launch-gallery-fancybox';
40 }
41 else {
42 lightbox_selector = 'a.launch-gallery-fancybox';
43 }
44
45 $(lightbox_selector).fancybox({
46 defaultType: 'image',
47 hash: false,
48 caption: function(instance, item) {
49 return $(this).data('title');
50 },
51 buttons: self.buttons,
52 slideShow: {
53 autoStart: Photonic_JS.slideshow_mode,
54 speed: parseInt(Photonic_JS.slideshow_interval, 10)
55 },
56 thumbs: {
57 autoStart: Photonic_JS.fb3_thumbs === '1',
58 hideOnClose: true
59 },
60 fullScreen: {
61 autoStart: Photonic_JS.fb3_fullscreen === '1'
62 },
63 protect: Photonic_JS.fb3_disable_right_click === '1',
64 transitionEffect: Photonic_JS.fb3_transition_effect,
65 transitionDuration: Photonic_JS.fb3_transition_speed,
66 afterShow: function(instance, slide) {
67 var shareable = {
68 'url': location.href,
69 'title': $(this).length > 0 && $(this)[0].opts !== undefined && $(this)[0].opts.$orig !== undefined ? photonicHtmlDecode($(this)[0].opts.$orig.attr('title')) : '',
70 'image': $(this).length > 0 && $(this)[0].opts !== undefined && $(this)[0].opts.$orig !== undefined ? $(this)[0].opts.$orig.attr('href') : ''
71 };
72 self.addSocial('.fancybox-caption', shareable);
73 },
74 beforeShow: function() {
75 var videoID = this.src;
76 var videoURL = this.opts.html5Href;
77 if (videoURL !== undefined) {
78 self.getVideoSize(videoURL, {height: window.innerHeight * 0.85, width: window.innerWidth * 0.85}).then(function(dimensions) {
79 $(videoID).find('video').attr('width', dimensions.newWidth).attr('height', dimensions.newHeight);
80 $(videoID).css({width: dimensions.newWidth, height: dimensions.newHeight});
81 });
82 }
83 self.setHash(this.opts.photonicDeep);
84 },
85 afterClose: function() {
86 self.unsetHash();
87 }
88 });
89
90 $('a.fancybox3-video,a.fancybox3-html5-video').fancybox({
91 youtube: { }
92 });
93 };
94
95 Photonic_Lightbox_Fancybox3.prototype.initializeForNewContainer = function(containerId) {
96 this.initialize(containerId);
97 };
98
99 photonicLightbox = new Photonic_Lightbox_Fancybox3();
100 photonicLightbox.initialize();
101