| 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 |
|