j1m_lightbox 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.md +21 -0
- data/README.md +41 -0
- data/_data/modules/default/j1_lightbox-0.0.1/j1_colorbox.yml +106 -0
- data/_data/modules/default/j1_lightbox-0.0.1/j1_light_gallery.yml +162 -0
- data/_data/modules/default/j1_lightbox-0.0.1/j1_lightbox2.yml +168 -0
- data/_data/resources/default/j1_lightbox-0.0.1/resource.yml +84 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_1/colorbox.css +93 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_1/images/border.png +0 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_1/images/controls.png +0 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_1/images/loading.gif +0 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_1/images/loading_background.png +0 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_1/images/overlay.png +0 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_2/colorbox.css +72 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_2/images/controls.png +0 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_2/images/loading.gif +0 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_3/colorbox.css +68 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_3/images/controls.png +0 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_3/images/loading.gif +0 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_4/colorbox.css +89 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_4/images/border1.png +0 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_4/images/border2.png +0 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_4/images/loading.gif +0 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_5/colorbox.css +81 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_5/images/border.png +0 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_5/images/controls.png +0 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_5/images/loading.gif +0 -0
- data/assets/themes/j1/lightboxes/colorbox/css/theme_5/images/loading_background.png +0 -0
- data/assets/themes/j1/lightboxes/colorbox/js/jquery.colorbox.js +1105 -0
- data/assets/themes/j1/lightboxes/colorbox/js/jquery.colorbox.min.js +6 -0
- data/assets/themes/j1/lightboxes/light_gallery/css/lg-fb-comment-box.css +57 -0
- data/assets/themes/j1/lightboxes/light_gallery/css/lg-fb-comment-box.min.css +1 -0
- data/assets/themes/j1/lightboxes/light_gallery/css/lg-transitions.css +778 -0
- data/assets/themes/j1/lightboxes/light_gallery/css/lg-transitions.min.css +1 -0
- data/assets/themes/j1/lightboxes/light_gallery/css/lightgallery.css +967 -0
- data/assets/themes/j1/lightboxes/light_gallery/css/lightgallery.min.css +1 -0
- data/assets/themes/j1/lightboxes/light_gallery/css/theme/j1_template.css +290 -0
- data/assets/themes/j1/lightboxes/light_gallery/fonts/lg.eot +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/fonts/lg.svg +47 -0
- data/assets/themes/j1/lightboxes/light_gallery/fonts/lg.ttf +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/fonts/lg.woff +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/icons/animation-w.png +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/icons/customize-w.png +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/icons/dynamic-w.png +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/icons/facebook-icon.svg +10 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/icons/googleplus-icon.svg +30 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/icons/html5-w.png +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/icons/linked-in.png +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/icons/module-w.png +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/icons/play-button.png +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/icons/responsive-w.png +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/icons/thumb-w.png +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/icons/touch-w.png +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/icons/twitter-icon.svg +15 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/icons/twitter.png +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/icons/video1-w.png +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/icons/zoom-w.png +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/icons/zoom.png +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/loading.gif +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/video-play.png +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/vimeo-play.png +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/img/youtube-play.png +0 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lg-autoplay.js +204 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lg-autoplay.min.js +4 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lg-fullscreen.js +116 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lg-fullscreen.min.js +4 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lg-hash.js +93 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lg-hash.min.js +4 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lg-pager.js +105 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lg-pager.min.js +4 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lg-share.js +92 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lg-share.min.js +4 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lg-thumbnail.js +473 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lg-thumbnail.min.js +4 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lg-video.js +312 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lg-video.min.js +4 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lg-zoom.js +497 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lg-zoom.min.js +4 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lightgallery.js +1340 -0
- data/assets/themes/j1/lightboxes/light_gallery/js/lightgallery.min.js +4 -0
- data/assets/themes/j1/lightboxes/lightbox2/css/lightbox.css +213 -0
- data/assets/themes/j1/lightboxes/lightbox2/css/lightbox.min.css +1 -0
- data/assets/themes/j1/lightboxes/lightbox2/images/close.png +0 -0
- data/assets/themes/j1/lightboxes/lightbox2/images/loading.gif +0 -0
- data/assets/themes/j1/lightboxes/lightbox2/images/next.png +0 -0
- data/assets/themes/j1/lightboxes/lightbox2/images/prev.png +0 -0
- data/assets/themes/j1/lightboxes/lightbox2/js/lightbox-plus-jquery.js +9719 -0
- data/assets/themes/j1/lightboxes/lightbox2/js/lightbox-plus-jquery.min.js +38 -0
- data/assets/themes/j1/lightboxes/lightbox2/js/lightbox-plus-jquery.min.map +1 -0
- data/assets/themes/j1/lightboxes/lightbox2/js/lightbox.js +508 -0
- data/assets/themes/j1/lightboxes/lightbox2/js/lightbox.min.js +13 -0
- data/assets/themes/j1/lightboxes/lightbox2/js/lightbox.min.map +1 -0
- data/exe/console +14 -0
- data/exe/setup +8 -0
- data/lib/j1m_lightbox.rb +5 -0
- data/lib/j1m_lightbox/version.rb +3 -0
- metadata +185 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! lg-thumbnail - v1.0.0 - 2016-09-20
|
|
2
|
+
* http://sachinchoolur.github.io/lightGallery
|
|
3
|
+
* Copyright (c) 2016 Sachin N; Licensed GPLv3 */
|
|
4
|
+
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){!function(a,b,c,d){"use strict";var e={thumbnail:!0,animateThumb:!0,currentPagerPosition:"middle",thumbWidth:100,thumbContHeight:100,thumbMargin:5,exThumbImage:!1,showThumbByDefault:!0,toogleThumb:!0,pullCaptionUp:!0,enableThumbDrag:!0,enableThumbSwipe:!0,swipeThreshold:50,loadYoutubeThumbnail:!0,youtubeThumbSize:1,loadVimeoThumbnail:!0,vimeoThumbSize:"thumbnail_small",loadDailymotionThumbnail:!0},f=function(b){return this.core=a(b).data("lightGallery"),this.core.s=a.extend({},e,this.core.s),this.$el=a(b),this.$thumbOuter=null,this.thumbOuterWidth=0,this.thumbTotalWidth=this.core.$items.length*(this.core.s.thumbWidth+this.core.s.thumbMargin),this.thumbIndex=this.core.index,this.left=0,this.init(),this};f.prototype.init=function(){var a=this;this.core.s.thumbnail&&this.core.$items.length>1&&(this.core.s.showThumbByDefault&&setTimeout(function(){a.core.$outer.addClass("lg-thumb-open")},700),this.core.s.pullCaptionUp&&this.core.$outer.addClass("lg-pull-caption-up"),this.build(),this.core.s.animateThumb?(this.core.s.enableThumbDrag&&!this.core.isTouch&&this.core.doCss()&&this.enableThumbDrag(),this.core.s.enableThumbSwipe&&this.core.isTouch&&this.core.doCss()&&this.enableThumbSwipe(),this.thumbClickable=!1):this.thumbClickable=!0,this.toogle(),this.thumbkeyPress())},f.prototype.build=function(){function c(a,b,c){var d,h=e.core.isVideo(a,c)||{},i="";h.youtube||h.vimeo||h.dailymotion?h.youtube?d=e.core.s.loadYoutubeThumbnail?"//img.youtube.com/vi/"+h.youtube[1]+"/"+e.core.s.youtubeThumbSize+".jpg":b:h.vimeo?e.core.s.loadVimeoThumbnail?(d="//i.vimeocdn.com/video/error_"+g+".jpg",i=h.vimeo[1]):d=b:h.dailymotion&&(d=e.core.s.loadDailymotionThumbnail?"//www.dailymotion.com/thumbnail/video/"+h.dailymotion[1]:b):d=b,f+='<div data-vimeo-id="'+i+'" class="lg-thumb-item" style="width:'+e.core.s.thumbWidth+"px; margin-right: "+e.core.s.thumbMargin+'px"><img src="'+d+'" /></div>',i=""}var d,e=this,f="",g="",h='<div class="lg-thumb-outer"><div class="lg-thumb group"></div></div>';switch(this.core.s.vimeoThumbSize){case"thumbnail_large":g="640";break;case"thumbnail_medium":g="200x150";break;case"thumbnail_small":g="100x75"}if(e.core.$outer.addClass("lg-has-thumb"),e.core.$outer.find(".lg").append(h),e.$thumbOuter=e.core.$outer.find(".lg-thumb-outer"),e.thumbOuterWidth=e.$thumbOuter.width(),e.core.s.animateThumb&&e.core.$outer.find(".lg-thumb").css({width:e.thumbTotalWidth+"px",position:"relative"}),this.core.s.animateThumb&&e.$thumbOuter.css("height",e.core.s.thumbContHeight+"px"),e.core.s.dynamic)for(var i=0;i<e.core.s.dynamicEl.length;i++)c(e.core.s.dynamicEl[i].src,e.core.s.dynamicEl[i].thumb,i);else e.core.$items.each(function(b){e.core.s.exThumbImage?c(a(this).attr("href")||a(this).attr("data-src"),a(this).attr(e.core.s.exThumbImage),b):c(a(this).attr("href")||a(this).attr("data-src"),a(this).find("img").attr("src"),b)});e.core.$outer.find(".lg-thumb").html(f),d=e.core.$outer.find(".lg-thumb-item"),d.each(function(){var b=a(this),c=b.attr("data-vimeo-id");c&&a.getJSON("//www.vimeo.com/api/v2/video/"+c+".json?callback=?",{format:"json"},function(a){b.find("img").attr("src",a[0][e.core.s.vimeoThumbSize])})}),d.eq(e.core.index).addClass("active"),e.core.$el.on("onBeforeSlide.lg.tm",function(){d.removeClass("active"),d.eq(e.core.index).addClass("active")}),d.on("click.lg touchend.lg",function(){var b=a(this);setTimeout(function(){(e.thumbClickable&&!e.core.lgBusy||!e.core.doCss())&&(e.core.index=b.index(),e.core.slide(e.core.index,!1,!0))},50)}),e.core.$el.on("onBeforeSlide.lg.tm",function(){e.animateThumb(e.core.index)}),a(b).on("resize.lg.thumb orientationchange.lg.thumb",function(){setTimeout(function(){e.animateThumb(e.core.index),e.thumbOuterWidth=e.$thumbOuter.width()},200)})},f.prototype.setTranslate=function(a){this.core.$outer.find(".lg-thumb").css({transform:"translate3d(-"+a+"px, 0px, 0px)"})},f.prototype.animateThumb=function(a){var b=this.core.$outer.find(".lg-thumb");if(this.core.s.animateThumb){var c;switch(this.core.s.currentPagerPosition){case"left":c=0;break;case"middle":c=this.thumbOuterWidth/2-this.core.s.thumbWidth/2;break;case"right":c=this.thumbOuterWidth-this.core.s.thumbWidth}this.left=(this.core.s.thumbWidth+this.core.s.thumbMargin)*a-1-c,this.left>this.thumbTotalWidth-this.thumbOuterWidth&&(this.left=this.thumbTotalWidth-this.thumbOuterWidth),this.left<0&&(this.left=0),this.core.lGalleryOn?(b.hasClass("on")||this.core.$outer.find(".lg-thumb").css("transition-duration",this.core.s.speed+"ms"),this.core.doCss()||b.animate({left:-this.left+"px"},this.core.s.speed)):this.core.doCss()||b.css("left",-this.left+"px"),this.setTranslate(this.left)}},f.prototype.enableThumbDrag=function(){var c=this,d=0,e=0,f=!1,g=!1,h=0;c.$thumbOuter.addClass("lg-grab"),c.core.$outer.find(".lg-thumb").on("mousedown.lg.thumb",function(a){c.thumbTotalWidth>c.thumbOuterWidth&&(a.preventDefault(),d=a.pageX,f=!0,c.core.$outer.scrollLeft+=1,c.core.$outer.scrollLeft-=1,c.thumbClickable=!1,c.$thumbOuter.removeClass("lg-grab").addClass("lg-grabbing"))}),a(b).on("mousemove.lg.thumb",function(a){f&&(h=c.left,g=!0,e=a.pageX,c.$thumbOuter.addClass("lg-dragging"),h-=e-d,h>c.thumbTotalWidth-c.thumbOuterWidth&&(h=c.thumbTotalWidth-c.thumbOuterWidth),h<0&&(h=0),c.setTranslate(h))}),a(b).on("mouseup.lg.thumb",function(){g?(g=!1,c.$thumbOuter.removeClass("lg-dragging"),c.left=h,Math.abs(e-d)<c.core.s.swipeThreshold&&(c.thumbClickable=!0)):c.thumbClickable=!0,f&&(f=!1,c.$thumbOuter.removeClass("lg-grabbing").addClass("lg-grab"))})},f.prototype.enableThumbSwipe=function(){var a=this,b=0,c=0,d=!1,e=0;a.core.$outer.find(".lg-thumb").on("touchstart.lg",function(c){a.thumbTotalWidth>a.thumbOuterWidth&&(c.preventDefault(),b=c.originalEvent.targetTouches[0].pageX,a.thumbClickable=!1)}),a.core.$outer.find(".lg-thumb").on("touchmove.lg",function(f){a.thumbTotalWidth>a.thumbOuterWidth&&(f.preventDefault(),c=f.originalEvent.targetTouches[0].pageX,d=!0,a.$thumbOuter.addClass("lg-dragging"),e=a.left,e-=c-b,e>a.thumbTotalWidth-a.thumbOuterWidth&&(e=a.thumbTotalWidth-a.thumbOuterWidth),e<0&&(e=0),a.setTranslate(e))}),a.core.$outer.find(".lg-thumb").on("touchend.lg",function(){a.thumbTotalWidth>a.thumbOuterWidth&&d?(d=!1,a.$thumbOuter.removeClass("lg-dragging"),Math.abs(c-b)<a.core.s.swipeThreshold&&(a.thumbClickable=!0),a.left=e):a.thumbClickable=!0})},f.prototype.toogle=function(){var a=this;a.core.s.toogleThumb&&(a.core.$outer.addClass("lg-can-toggle"),a.$thumbOuter.append('<span class="lg-toogle-thumb lg-icon"></span>'),a.core.$outer.find(".lg-toogle-thumb").on("click.lg",function(){a.core.$outer.toggleClass("lg-thumb-open")}))},f.prototype.thumbkeyPress=function(){var c=this;a(b).on("keydown.lg.thumb",function(a){38===a.keyCode?(a.preventDefault(),c.core.$outer.addClass("lg-thumb-open")):40===a.keyCode&&(a.preventDefault(),c.core.$outer.removeClass("lg-thumb-open"))})},f.prototype.destroy=function(){this.core.s.thumbnail&&this.core.$items.length>1&&(a(b).off("resize.lg.thumb orientationchange.lg.thumb keydown.lg.thumb"),this.$thumbOuter.remove(),this.core.$outer.removeClass("lg-has-thumb"))},a.fn.lightGallery.modules.Thumbnail=f}(jQuery,window,document)});
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/*! lg-video - v1.0.0 - 2016-09-20
|
|
2
|
+
* http://sachinchoolur.github.io/lightGallery
|
|
3
|
+
* Copyright (c) 2016 Sachin N; Licensed GPLv3 */
|
|
4
|
+
|
|
5
|
+
(function (root, factory) {
|
|
6
|
+
if (typeof define === 'function' && define.amd) {
|
|
7
|
+
// AMD. Register as an anonymous module unless amdModuleId is set
|
|
8
|
+
define([], function () {
|
|
9
|
+
return (factory());
|
|
10
|
+
});
|
|
11
|
+
} else if (typeof exports === 'object') {
|
|
12
|
+
// Node. Does not work with strict CommonJS, but
|
|
13
|
+
// only CommonJS-like environments that support module.exports,
|
|
14
|
+
// like Node.
|
|
15
|
+
module.exports = factory();
|
|
16
|
+
} else {
|
|
17
|
+
factory();
|
|
18
|
+
}
|
|
19
|
+
}(this, function () {
|
|
20
|
+
|
|
21
|
+
(function($, window, document, undefined) {
|
|
22
|
+
|
|
23
|
+
'use strict';
|
|
24
|
+
|
|
25
|
+
var defaults = {
|
|
26
|
+
videoMaxWidth: '855px',
|
|
27
|
+
youtubePlayerParams: false,
|
|
28
|
+
vimeoPlayerParams: false,
|
|
29
|
+
dailymotionPlayerParams: false,
|
|
30
|
+
vkPlayerParams: false,
|
|
31
|
+
videojs: false,
|
|
32
|
+
videojsOptions: {}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var Video = function(element) {
|
|
36
|
+
|
|
37
|
+
this.core = $(element).data('lightGallery');
|
|
38
|
+
|
|
39
|
+
this.$el = $(element);
|
|
40
|
+
this.core.s = $.extend({}, defaults, this.core.s);
|
|
41
|
+
this.videoLoaded = false;
|
|
42
|
+
|
|
43
|
+
this.init();
|
|
44
|
+
|
|
45
|
+
return this;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
Video.prototype.init = function() {
|
|
49
|
+
var _this = this;
|
|
50
|
+
|
|
51
|
+
// Event triggered when video url found without poster
|
|
52
|
+
_this.core.$el.on('hasVideo.lg.tm', function(event, index, src, html) {
|
|
53
|
+
_this.core.$slide.eq(index).find('.lg-video').append(_this.loadVideo(src, 'lg-object', true, index, html));
|
|
54
|
+
if (html) {
|
|
55
|
+
if (_this.core.s.videojs) {
|
|
56
|
+
try {
|
|
57
|
+
videojs(_this.core.$slide.eq(index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() {
|
|
58
|
+
if (!_this.videoLoaded) {
|
|
59
|
+
this.play();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
} catch (e) {
|
|
63
|
+
console.error('Make sure you have included videojs');
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
_this.core.$slide.eq(index).find('.lg-html5').get(0).play();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Set max width for video
|
|
72
|
+
_this.core.$el.on('onAferAppendSlide.lg.tm', function(event, index) {
|
|
73
|
+
_this.core.$slide.eq(index).find('.lg-video-cont').css('max-width', _this.core.s.videoMaxWidth);
|
|
74
|
+
_this.videoLoaded = true;
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
var loadOnClick = function($el) {
|
|
78
|
+
// check slide has poster
|
|
79
|
+
if ($el.find('.lg-object').hasClass('lg-has-poster') && $el.find('.lg-object').is(':visible')) {
|
|
80
|
+
|
|
81
|
+
// check already video element present
|
|
82
|
+
if (!$el.hasClass('lg-has-video')) {
|
|
83
|
+
|
|
84
|
+
$el.addClass('lg-video-playing lg-has-video');
|
|
85
|
+
|
|
86
|
+
var _src;
|
|
87
|
+
var _html;
|
|
88
|
+
var _loadVideo = function(_src, _html) {
|
|
89
|
+
|
|
90
|
+
$el.find('.lg-video').append(_this.loadVideo(_src, '', false, _this.core.index, _html));
|
|
91
|
+
|
|
92
|
+
if (_html) {
|
|
93
|
+
if (_this.core.s.videojs) {
|
|
94
|
+
try {
|
|
95
|
+
videojs(_this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() {
|
|
96
|
+
this.play();
|
|
97
|
+
});
|
|
98
|
+
} catch (e) {
|
|
99
|
+
console.error('Make sure you have included videojs');
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
_this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0).play();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
if (_this.core.s.dynamic) {
|
|
109
|
+
|
|
110
|
+
_src = _this.core.s.dynamicEl[_this.core.index].src;
|
|
111
|
+
_html = _this.core.s.dynamicEl[_this.core.index].html;
|
|
112
|
+
|
|
113
|
+
_loadVideo(_src, _html);
|
|
114
|
+
|
|
115
|
+
} else {
|
|
116
|
+
|
|
117
|
+
_src = _this.core.$items.eq(_this.core.index).attr('href') || _this.core.$items.eq(_this.core.index).attr('data-src');
|
|
118
|
+
_html = _this.core.$items.eq(_this.core.index).attr('data-html');
|
|
119
|
+
|
|
120
|
+
_loadVideo(_src, _html);
|
|
121
|
+
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
var $tempImg = $el.find('.lg-object');
|
|
125
|
+
$el.find('.lg-video').append($tempImg);
|
|
126
|
+
|
|
127
|
+
// @todo loading icon for html5 videos also
|
|
128
|
+
// for showing the loading indicator while loading video
|
|
129
|
+
if (!$el.find('.lg-video-object').hasClass('lg-html5')) {
|
|
130
|
+
$el.removeClass('lg-complete');
|
|
131
|
+
$el.find('.lg-video-object').on('load.lg error.lg', function() {
|
|
132
|
+
$el.addClass('lg-complete');
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
} else {
|
|
137
|
+
|
|
138
|
+
var youtubePlayer = $el.find('.lg-youtube').get(0);
|
|
139
|
+
var vimeoPlayer = $el.find('.lg-vimeo').get(0);
|
|
140
|
+
var dailymotionPlayer = $el.find('.lg-dailymotion').get(0);
|
|
141
|
+
var html5Player = $el.find('.lg-html5').get(0);
|
|
142
|
+
if (youtubePlayer) {
|
|
143
|
+
youtubePlayer.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
|
|
144
|
+
} else if (vimeoPlayer) {
|
|
145
|
+
try {
|
|
146
|
+
$f(vimeoPlayer).api('play');
|
|
147
|
+
} catch (e) {
|
|
148
|
+
console.error('Make sure you have included froogaloop2 js');
|
|
149
|
+
}
|
|
150
|
+
} else if (dailymotionPlayer) {
|
|
151
|
+
dailymotionPlayer.contentWindow.postMessage('play', '*');
|
|
152
|
+
|
|
153
|
+
} else if (html5Player) {
|
|
154
|
+
if (_this.core.s.videojs) {
|
|
155
|
+
try {
|
|
156
|
+
videojs(html5Player).play();
|
|
157
|
+
} catch (e) {
|
|
158
|
+
console.error('Make sure you have included videojs');
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
html5Player.play();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
$el.addClass('lg-video-playing');
|
|
166
|
+
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
if (_this.core.doCss() && _this.core.$items.length > 1 && ((_this.core.s.enableSwipe && _this.core.isTouch) || (_this.core.s.enableDrag && !_this.core.isTouch))) {
|
|
172
|
+
_this.core.$el.on('onSlideClick.lg.tm', function() {
|
|
173
|
+
var $el = _this.core.$slide.eq(_this.core.index);
|
|
174
|
+
loadOnClick($el);
|
|
175
|
+
});
|
|
176
|
+
} else {
|
|
177
|
+
|
|
178
|
+
// For IE 9 and bellow
|
|
179
|
+
_this.core.$slide.on('click.lg', function() {
|
|
180
|
+
loadOnClick($(this));
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
_this.core.$el.on('onBeforeSlide.lg.tm', function(event, prevIndex, index) {
|
|
185
|
+
|
|
186
|
+
var $videoSlide = _this.core.$slide.eq(prevIndex);
|
|
187
|
+
var youtubePlayer = $videoSlide.find('.lg-youtube').get(0);
|
|
188
|
+
var vimeoPlayer = $videoSlide.find('.lg-vimeo').get(0);
|
|
189
|
+
var dailymotionPlayer = $videoSlide.find('.lg-dailymotion').get(0);
|
|
190
|
+
var vkPlayer = $videoSlide.find('.lg-vk').get(0);
|
|
191
|
+
var html5Player = $videoSlide.find('.lg-html5').get(0);
|
|
192
|
+
if (youtubePlayer) {
|
|
193
|
+
youtubePlayer.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
|
|
194
|
+
} else if (vimeoPlayer) {
|
|
195
|
+
try {
|
|
196
|
+
$f(vimeoPlayer).api('pause');
|
|
197
|
+
} catch (e) {
|
|
198
|
+
console.error('Make sure you have included froogaloop2 js');
|
|
199
|
+
}
|
|
200
|
+
} else if (dailymotionPlayer) {
|
|
201
|
+
dailymotionPlayer.contentWindow.postMessage('pause', '*');
|
|
202
|
+
|
|
203
|
+
} else if (html5Player) {
|
|
204
|
+
if (_this.core.s.videojs) {
|
|
205
|
+
try {
|
|
206
|
+
videojs(html5Player).pause();
|
|
207
|
+
} catch (e) {
|
|
208
|
+
console.error('Make sure you have included videojs');
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
html5Player.pause();
|
|
212
|
+
}
|
|
213
|
+
} if (vkPlayer) {
|
|
214
|
+
$(vkPlayer).attr('src', $(vkPlayer).attr('src').replace('&autoplay', '&noplay'));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
var _src;
|
|
218
|
+
if (_this.core.s.dynamic) {
|
|
219
|
+
_src = _this.core.s.dynamicEl[index].src;
|
|
220
|
+
} else {
|
|
221
|
+
_src = _this.core.$items.eq(index).attr('href') || _this.core.$items.eq(index).attr('data-src');
|
|
222
|
+
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
var _isVideo = _this.core.isVideo(_src, index) || {};
|
|
226
|
+
if (_isVideo.youtube || _isVideo.vimeo || _isVideo.dailymotion || _isVideo.vk) {
|
|
227
|
+
_this.core.$outer.addClass('lg-hide-download');
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
//$videoSlide.addClass('lg-complete');
|
|
231
|
+
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
_this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex) {
|
|
235
|
+
_this.core.$slide.eq(prevIndex).removeClass('lg-video-playing');
|
|
236
|
+
});
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
Video.prototype.loadVideo = function(src, addClass, noposter, index, html) {
|
|
240
|
+
var video = '';
|
|
241
|
+
var autoplay = 1;
|
|
242
|
+
var a = '';
|
|
243
|
+
var isVideo = this.core.isVideo(src, index) || {};
|
|
244
|
+
|
|
245
|
+
// Enable autoplay for first video if poster doesn't exist
|
|
246
|
+
if (noposter) {
|
|
247
|
+
if (this.videoLoaded) {
|
|
248
|
+
autoplay = 0;
|
|
249
|
+
} else {
|
|
250
|
+
autoplay = 1;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (isVideo.youtube) {
|
|
255
|
+
|
|
256
|
+
a = '?wmode=opaque&autoplay=' + autoplay + '&enablejsapi=1';
|
|
257
|
+
if (this.core.s.youtubePlayerParams) {
|
|
258
|
+
a = a + '&' + $.param(this.core.s.youtubePlayerParams);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
video = '<iframe class="lg-video-object lg-youtube ' + addClass + '" width="560" height="315" src="//www.youtube.com/embed/' + isVideo.youtube[1] + a + '" frameborder="0" allowfullscreen></iframe>';
|
|
262
|
+
|
|
263
|
+
} else if (isVideo.vimeo) {
|
|
264
|
+
|
|
265
|
+
a = '?autoplay=' + autoplay + '&api=1';
|
|
266
|
+
if (this.core.s.vimeoPlayerParams) {
|
|
267
|
+
a = a + '&' + $.param(this.core.s.vimeoPlayerParams);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
video = '<iframe class="lg-video-object lg-vimeo ' + addClass + '" width="560" height="315" src="//player.vimeo.com/video/' + isVideo.vimeo[1] + a + '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
|
|
271
|
+
|
|
272
|
+
} else if (isVideo.dailymotion) {
|
|
273
|
+
|
|
274
|
+
a = '?wmode=opaque&autoplay=' + autoplay + '&api=postMessage';
|
|
275
|
+
if (this.core.s.dailymotionPlayerParams) {
|
|
276
|
+
a = a + '&' + $.param(this.core.s.dailymotionPlayerParams);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
video = '<iframe class="lg-video-object lg-dailymotion ' + addClass + '" width="560" height="315" src="//www.dailymotion.com/embed/video/' + isVideo.dailymotion[1] + a + '" frameborder="0" allowfullscreen></iframe>';
|
|
280
|
+
|
|
281
|
+
} else if (isVideo.html5) {
|
|
282
|
+
var fL = html.substring(0, 1);
|
|
283
|
+
if (fL === '.' || fL === '#') {
|
|
284
|
+
html = $(html).html();
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
video = html;
|
|
288
|
+
|
|
289
|
+
} else if (isVideo.vk) {
|
|
290
|
+
|
|
291
|
+
a = '&autoplay=' + autoplay;
|
|
292
|
+
if (this.core.s.vkPlayerParams) {
|
|
293
|
+
a = a + '&' + $.param(this.core.s.vkPlayerParams);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
video = '<iframe class="lg-video-object lg-vk ' + addClass + '" width="560" height="315" src="http://vk.com/video_ext.php?' + isVideo.vk[1] + a + '" frameborder="0" allowfullscreen></iframe>';
|
|
297
|
+
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return video;
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
Video.prototype.destroy = function() {
|
|
304
|
+
this.videoLoaded = false;
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
$.fn.lightGallery.modules.video = Video;
|
|
308
|
+
|
|
309
|
+
})(jQuery, window, document);
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
}));
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! lg-video - v1.0.0 - 2016-09-20
|
|
2
|
+
* http://sachinchoolur.github.io/lightGallery
|
|
3
|
+
* Copyright (c) 2016 Sachin N; Licensed GPLv3 */
|
|
4
|
+
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){!function(a,b,c,d){"use strict";var e={videoMaxWidth:"855px",youtubePlayerParams:!1,vimeoPlayerParams:!1,dailymotionPlayerParams:!1,vkPlayerParams:!1,videojs:!1,videojsOptions:{}},f=function(b){return this.core=a(b).data("lightGallery"),this.$el=a(b),this.core.s=a.extend({},e,this.core.s),this.videoLoaded=!1,this.init(),this};f.prototype.init=function(){var b=this;b.core.$el.on("hasVideo.lg.tm",function(a,c,d,e){if(b.core.$slide.eq(c).find(".lg-video").append(b.loadVideo(d,"lg-object",!0,c,e)),e)if(b.core.s.videojs)try{videojs(b.core.$slide.eq(c).find(".lg-html5").get(0),b.core.s.videojsOptions,function(){b.videoLoaded||this.play()})}catch(a){console.error("Make sure you have included videojs")}else b.core.$slide.eq(c).find(".lg-html5").get(0).play()}),b.core.$el.on("onAferAppendSlide.lg.tm",function(a,c){b.core.$slide.eq(c).find(".lg-video-cont").css("max-width",b.core.s.videoMaxWidth),b.videoLoaded=!0});var c=function(a){if(a.find(".lg-object").hasClass("lg-has-poster")&&a.find(".lg-object").is(":visible"))if(a.hasClass("lg-has-video")){var c=a.find(".lg-youtube").get(0),d=a.find(".lg-vimeo").get(0),e=a.find(".lg-dailymotion").get(0),f=a.find(".lg-html5").get(0);if(c)c.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}',"*");else if(d)try{$f(d).api("play")}catch(a){console.error("Make sure you have included froogaloop2 js")}else if(e)e.contentWindow.postMessage("play","*");else if(f)if(b.core.s.videojs)try{videojs(f).play()}catch(a){console.error("Make sure you have included videojs")}else f.play();a.addClass("lg-video-playing")}else{a.addClass("lg-video-playing lg-has-video");var g,h,i=function(c,d){if(a.find(".lg-video").append(b.loadVideo(c,"",!1,b.core.index,d)),d)if(b.core.s.videojs)try{videojs(b.core.$slide.eq(b.core.index).find(".lg-html5").get(0),b.core.s.videojsOptions,function(){this.play()})}catch(a){console.error("Make sure you have included videojs")}else b.core.$slide.eq(b.core.index).find(".lg-html5").get(0).play()};b.core.s.dynamic?(g=b.core.s.dynamicEl[b.core.index].src,h=b.core.s.dynamicEl[b.core.index].html,i(g,h)):(g=b.core.$items.eq(b.core.index).attr("href")||b.core.$items.eq(b.core.index).attr("data-src"),h=b.core.$items.eq(b.core.index).attr("data-html"),i(g,h));var j=a.find(".lg-object");a.find(".lg-video").append(j),a.find(".lg-video-object").hasClass("lg-html5")||(a.removeClass("lg-complete"),a.find(".lg-video-object").on("load.lg error.lg",function(){a.addClass("lg-complete")}))}};b.core.doCss()&&b.core.$items.length>1&&(b.core.s.enableSwipe&&b.core.isTouch||b.core.s.enableDrag&&!b.core.isTouch)?b.core.$el.on("onSlideClick.lg.tm",function(){var a=b.core.$slide.eq(b.core.index);c(a)}):b.core.$slide.on("click.lg",function(){c(a(this))}),b.core.$el.on("onBeforeSlide.lg.tm",function(c,d,e){var f=b.core.$slide.eq(d),g=f.find(".lg-youtube").get(0),h=f.find(".lg-vimeo").get(0),i=f.find(".lg-dailymotion").get(0),j=f.find(".lg-vk").get(0),k=f.find(".lg-html5").get(0);if(g)g.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*");else if(h)try{$f(h).api("pause")}catch(a){console.error("Make sure you have included froogaloop2 js")}else if(i)i.contentWindow.postMessage("pause","*");else if(k)if(b.core.s.videojs)try{videojs(k).pause()}catch(a){console.error("Make sure you have included videojs")}else k.pause();j&&a(j).attr("src",a(j).attr("src").replace("&autoplay","&noplay"));var l;l=b.core.s.dynamic?b.core.s.dynamicEl[e].src:b.core.$items.eq(e).attr("href")||b.core.$items.eq(e).attr("data-src");var m=b.core.isVideo(l,e)||{};(m.youtube||m.vimeo||m.dailymotion||m.vk)&&b.core.$outer.addClass("lg-hide-download")}),b.core.$el.on("onAfterSlide.lg.tm",function(a,c){b.core.$slide.eq(c).removeClass("lg-video-playing")})},f.prototype.loadVideo=function(b,c,d,e,f){var g="",h=1,i="",j=this.core.isVideo(b,e)||{};if(d&&(h=this.videoLoaded?0:1),j.youtube)i="?wmode=opaque&autoplay="+h+"&enablejsapi=1",this.core.s.youtubePlayerParams&&(i=i+"&"+a.param(this.core.s.youtubePlayerParams)),g='<iframe class="lg-video-object lg-youtube '+c+'" width="560" height="315" src="//www.youtube.com/embed/'+j.youtube[1]+i+'" frameborder="0" allowfullscreen></iframe>';else if(j.vimeo)i="?autoplay="+h+"&api=1",this.core.s.vimeoPlayerParams&&(i=i+"&"+a.param(this.core.s.vimeoPlayerParams)),g='<iframe class="lg-video-object lg-vimeo '+c+'" width="560" height="315" src="//player.vimeo.com/video/'+j.vimeo[1]+i+'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';else if(j.dailymotion)i="?wmode=opaque&autoplay="+h+"&api=postMessage",this.core.s.dailymotionPlayerParams&&(i=i+"&"+a.param(this.core.s.dailymotionPlayerParams)),g='<iframe class="lg-video-object lg-dailymotion '+c+'" width="560" height="315" src="//www.dailymotion.com/embed/video/'+j.dailymotion[1]+i+'" frameborder="0" allowfullscreen></iframe>';else if(j.html5){var k=f.substring(0,1);"."!==k&&"#"!==k||(f=a(f).html()),g=f}else j.vk&&(i="&autoplay="+h,this.core.s.vkPlayerParams&&(i=i+"&"+a.param(this.core.s.vkPlayerParams)),g='<iframe class="lg-video-object lg-vk '+c+'" width="560" height="315" src="http://vk.com/video_ext.php?'+j.vk[1]+i+'" frameborder="0" allowfullscreen></iframe>');return g},f.prototype.destroy=function(){this.videoLoaded=!1},a.fn.lightGallery.modules.video=f}(jQuery,window,document)});
|
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
/*! lg-zoom - v1.0.2 - 2016-11-20
|
|
2
|
+
* http://sachinchoolur.github.io/lightGallery
|
|
3
|
+
* Copyright (c) 2016 Sachin N; Licensed GPLv3 */
|
|
4
|
+
|
|
5
|
+
(function (root, factory) {
|
|
6
|
+
if (typeof define === 'function' && define.amd) {
|
|
7
|
+
// AMD. Register as an anonymous module unless amdModuleId is set
|
|
8
|
+
define(['jquery'], function (a0) {
|
|
9
|
+
return (factory(a0));
|
|
10
|
+
});
|
|
11
|
+
} else if (typeof exports === 'object') {
|
|
12
|
+
// Node. Does not work with strict CommonJS, but
|
|
13
|
+
// only CommonJS-like environments that support module.exports,
|
|
14
|
+
// like Node.
|
|
15
|
+
module.exports = factory(require('jquery'));
|
|
16
|
+
} else {
|
|
17
|
+
factory(jQuery);
|
|
18
|
+
}
|
|
19
|
+
}(this, function ($) {
|
|
20
|
+
|
|
21
|
+
(function() {
|
|
22
|
+
|
|
23
|
+
'use strict';
|
|
24
|
+
|
|
25
|
+
var defaults = {
|
|
26
|
+
scale: 1,
|
|
27
|
+
zoom: true,
|
|
28
|
+
actualSize: true,
|
|
29
|
+
enableZoomAfter: 300
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var Zoom = function(element) {
|
|
33
|
+
|
|
34
|
+
this.core = $(element).data('lightGallery');
|
|
35
|
+
|
|
36
|
+
this.core.s = $.extend({}, defaults, this.core.s);
|
|
37
|
+
|
|
38
|
+
if (this.core.s.zoom && this.core.doCss()) {
|
|
39
|
+
this.init();
|
|
40
|
+
|
|
41
|
+
// Store the zoomable timeout value just to clear it while closing
|
|
42
|
+
this.zoomabletimeout = false;
|
|
43
|
+
|
|
44
|
+
// Set the initial value center
|
|
45
|
+
this.pageX = $(window).width() / 2;
|
|
46
|
+
this.pageY = ($(window).height() / 2) + $(window).scrollTop();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return this;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
Zoom.prototype.init = function() {
|
|
53
|
+
|
|
54
|
+
var _this = this;
|
|
55
|
+
var zoomIcons = '<span id="lg-zoom-in" class="lg-icon"></span><span id="lg-zoom-out" class="lg-icon"></span>';
|
|
56
|
+
|
|
57
|
+
if (_this.core.s.actualSize) {
|
|
58
|
+
zoomIcons += '<span id="lg-actual-size" class="lg-icon"></span>';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
this.core.$outer.find('.lg-toolbar').append(zoomIcons);
|
|
62
|
+
|
|
63
|
+
// Add zoomable class
|
|
64
|
+
_this.core.$el.on('onSlideItemLoad.lg.tm.zoom', function(event, index, delay) {
|
|
65
|
+
|
|
66
|
+
// delay will be 0 except first time
|
|
67
|
+
var _speed = _this.core.s.enableZoomAfter + delay;
|
|
68
|
+
|
|
69
|
+
// set _speed value 0 if gallery opened from direct url and if it is first slide
|
|
70
|
+
if ($('body').hasClass('lg-from-hash') && delay) {
|
|
71
|
+
|
|
72
|
+
// will execute only once
|
|
73
|
+
_speed = 0;
|
|
74
|
+
} else {
|
|
75
|
+
|
|
76
|
+
// Remove lg-from-hash to enable starting animation.
|
|
77
|
+
$('body').removeClass('lg-from-hash');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
_this.zoomabletimeout = setTimeout(function() {
|
|
81
|
+
_this.core.$slide.eq(index).addClass('lg-zoomable');
|
|
82
|
+
}, _speed + 30);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
var scale = 1;
|
|
86
|
+
/**
|
|
87
|
+
* @desc Image zoom
|
|
88
|
+
* Translate the wrap and scale the image to get better user experience
|
|
89
|
+
*
|
|
90
|
+
* @param {String} scaleVal - Zoom decrement/increment value
|
|
91
|
+
*/
|
|
92
|
+
var zoom = function(scaleVal) {
|
|
93
|
+
|
|
94
|
+
var $image = _this.core.$outer.find('.lg-current .lg-image');
|
|
95
|
+
var _x;
|
|
96
|
+
var _y;
|
|
97
|
+
|
|
98
|
+
// Find offset manually to avoid issue after zoom
|
|
99
|
+
var offsetX = ($(window).width() - $image.prop('offsetWidth')) / 2;
|
|
100
|
+
var offsetY = (($(window).height() - $image.prop('offsetHeight')) / 2) + $(window).scrollTop();
|
|
101
|
+
|
|
102
|
+
_x = _this.pageX - offsetX;
|
|
103
|
+
_y = _this.pageY - offsetY;
|
|
104
|
+
|
|
105
|
+
var x = (scaleVal - 1) * (_x);
|
|
106
|
+
var y = (scaleVal - 1) * (_y);
|
|
107
|
+
|
|
108
|
+
$image.css('transform', 'scale3d(' + scaleVal + ', ' + scaleVal + ', 1)').attr('data-scale', scaleVal);
|
|
109
|
+
|
|
110
|
+
$image.parent().css({
|
|
111
|
+
left: -x + 'px',
|
|
112
|
+
top: -y + 'px'
|
|
113
|
+
}).attr('data-x', x).attr('data-y', y);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
var callScale = function() {
|
|
117
|
+
if (scale > 1) {
|
|
118
|
+
_this.core.$outer.addClass('lg-zoomed');
|
|
119
|
+
} else {
|
|
120
|
+
_this.resetZoom();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (scale < 1) {
|
|
124
|
+
scale = 1;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
zoom(scale);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
var actualSize = function(event, $image, index, fromIcon) {
|
|
131
|
+
var w = $image.prop('offsetWidth');
|
|
132
|
+
var nw;
|
|
133
|
+
if (_this.core.s.dynamic) {
|
|
134
|
+
nw = _this.core.s.dynamicEl[index].width || $image[0].naturalWidth || w;
|
|
135
|
+
} else {
|
|
136
|
+
nw = _this.core.$items.eq(index).attr('data-width') || $image[0].naturalWidth || w;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
var _scale;
|
|
140
|
+
|
|
141
|
+
if (_this.core.$outer.hasClass('lg-zoomed')) {
|
|
142
|
+
scale = 1;
|
|
143
|
+
} else {
|
|
144
|
+
if (nw > w) {
|
|
145
|
+
_scale = nw / w;
|
|
146
|
+
scale = _scale || 2;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (fromIcon) {
|
|
151
|
+
_this.pageX = $(window).width() / 2;
|
|
152
|
+
_this.pageY = ($(window).height() / 2) + $(window).scrollTop();
|
|
153
|
+
} else {
|
|
154
|
+
_this.pageX = event.pageX || event.originalEvent.targetTouches[0].pageX;
|
|
155
|
+
_this.pageY = event.pageY || event.originalEvent.targetTouches[0].pageY;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
callScale();
|
|
159
|
+
setTimeout(function() {
|
|
160
|
+
_this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab');
|
|
161
|
+
}, 10);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
var tapped = false;
|
|
165
|
+
|
|
166
|
+
// event triggered after appending slide content
|
|
167
|
+
_this.core.$el.on('onAferAppendSlide.lg.tm.zoom', function(event, index) {
|
|
168
|
+
|
|
169
|
+
// Get the current element
|
|
170
|
+
var $image = _this.core.$slide.eq(index).find('.lg-image');
|
|
171
|
+
|
|
172
|
+
$image.on('dblclick', function(event) {
|
|
173
|
+
actualSize(event, $image, index);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
$image.on('touchstart', function(event) {
|
|
177
|
+
if (!tapped) {
|
|
178
|
+
tapped = setTimeout(function() {
|
|
179
|
+
tapped = null;
|
|
180
|
+
}, 300);
|
|
181
|
+
} else {
|
|
182
|
+
clearTimeout(tapped);
|
|
183
|
+
tapped = null;
|
|
184
|
+
actualSize(event, $image, index);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
event.preventDefault();
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
// Update zoom on resize and orientationchange
|
|
193
|
+
$(window).on('resize.lg.zoom scroll.lg.zoom orientationchange.lg.zoom', function() {
|
|
194
|
+
_this.pageX = $(window).width() / 2;
|
|
195
|
+
_this.pageY = ($(window).height() / 2) + $(window).scrollTop();
|
|
196
|
+
zoom(scale);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
$('#lg-zoom-out').on('click.lg', function() {
|
|
200
|
+
if (_this.core.$outer.find('.lg-current .lg-image').length) {
|
|
201
|
+
scale -= _this.core.s.scale;
|
|
202
|
+
callScale();
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
$('#lg-zoom-in').on('click.lg', function() {
|
|
207
|
+
if (_this.core.$outer.find('.lg-current .lg-image').length) {
|
|
208
|
+
scale += _this.core.s.scale;
|
|
209
|
+
callScale();
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
$('#lg-actual-size').on('click.lg', function(event) {
|
|
214
|
+
actualSize(event, _this.core.$slide.eq(_this.core.index).find('.lg-image'), _this.core.index, true);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// Reset zoom on slide change
|
|
218
|
+
_this.core.$el.on('onBeforeSlide.lg.tm', function() {
|
|
219
|
+
scale = 1;
|
|
220
|
+
_this.resetZoom();
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
// Drag option after zoom
|
|
224
|
+
if (!_this.core.isTouch) {
|
|
225
|
+
_this.zoomDrag();
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (_this.core.isTouch) {
|
|
229
|
+
_this.zoomSwipe();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// Reset zoom effect
|
|
235
|
+
Zoom.prototype.resetZoom = function() {
|
|
236
|
+
this.core.$outer.removeClass('lg-zoomed');
|
|
237
|
+
this.core.$slide.find('.lg-img-wrap').removeAttr('style data-x data-y');
|
|
238
|
+
this.core.$slide.find('.lg-image').removeAttr('style data-scale');
|
|
239
|
+
|
|
240
|
+
// Reset pagx pagy values to center
|
|
241
|
+
this.pageX = $(window).width() / 2;
|
|
242
|
+
this.pageY = ($(window).height() / 2) + $(window).scrollTop();
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
Zoom.prototype.zoomSwipe = function() {
|
|
246
|
+
var _this = this;
|
|
247
|
+
var startCoords = {};
|
|
248
|
+
var endCoords = {};
|
|
249
|
+
var isMoved = false;
|
|
250
|
+
|
|
251
|
+
// Allow x direction drag
|
|
252
|
+
var allowX = false;
|
|
253
|
+
|
|
254
|
+
// Allow Y direction drag
|
|
255
|
+
var allowY = false;
|
|
256
|
+
|
|
257
|
+
_this.core.$slide.on('touchstart.lg', function(e) {
|
|
258
|
+
|
|
259
|
+
if (_this.core.$outer.hasClass('lg-zoomed')) {
|
|
260
|
+
var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
|
|
261
|
+
|
|
262
|
+
allowY = $image.prop('offsetHeight') * $image.attr('data-scale') > _this.core.$outer.find('.lg').height();
|
|
263
|
+
allowX = $image.prop('offsetWidth') * $image.attr('data-scale') > _this.core.$outer.find('.lg').width();
|
|
264
|
+
if ((allowX || allowY)) {
|
|
265
|
+
e.preventDefault();
|
|
266
|
+
startCoords = {
|
|
267
|
+
x: e.originalEvent.targetTouches[0].pageX,
|
|
268
|
+
y: e.originalEvent.targetTouches[0].pageY
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
_this.core.$slide.on('touchmove.lg', function(e) {
|
|
276
|
+
|
|
277
|
+
if (_this.core.$outer.hasClass('lg-zoomed')) {
|
|
278
|
+
|
|
279
|
+
var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
|
|
280
|
+
var distanceX;
|
|
281
|
+
var distanceY;
|
|
282
|
+
|
|
283
|
+
e.preventDefault();
|
|
284
|
+
isMoved = true;
|
|
285
|
+
|
|
286
|
+
endCoords = {
|
|
287
|
+
x: e.originalEvent.targetTouches[0].pageX,
|
|
288
|
+
y: e.originalEvent.targetTouches[0].pageY
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
// reset opacity and transition duration
|
|
292
|
+
_this.core.$outer.addClass('lg-zoom-dragging');
|
|
293
|
+
|
|
294
|
+
if (allowY) {
|
|
295
|
+
distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
|
|
296
|
+
} else {
|
|
297
|
+
distanceY = -Math.abs(_$el.attr('data-y'));
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (allowX) {
|
|
301
|
+
distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
|
|
302
|
+
} else {
|
|
303
|
+
distanceX = -Math.abs(_$el.attr('data-x'));
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
|
|
307
|
+
_$el.css({
|
|
308
|
+
left: distanceX + 'px',
|
|
309
|
+
top: distanceY + 'px'
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
_this.core.$slide.on('touchend.lg', function() {
|
|
318
|
+
if (_this.core.$outer.hasClass('lg-zoomed')) {
|
|
319
|
+
if (isMoved) {
|
|
320
|
+
isMoved = false;
|
|
321
|
+
_this.core.$outer.removeClass('lg-zoom-dragging');
|
|
322
|
+
_this.touchendZoom(startCoords, endCoords, allowX, allowY);
|
|
323
|
+
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
Zoom.prototype.zoomDrag = function() {
|
|
331
|
+
|
|
332
|
+
var _this = this;
|
|
333
|
+
var startCoords = {};
|
|
334
|
+
var endCoords = {};
|
|
335
|
+
var isDraging = false;
|
|
336
|
+
var isMoved = false;
|
|
337
|
+
|
|
338
|
+
// Allow x direction drag
|
|
339
|
+
var allowX = false;
|
|
340
|
+
|
|
341
|
+
// Allow Y direction drag
|
|
342
|
+
var allowY = false;
|
|
343
|
+
|
|
344
|
+
_this.core.$slide.on('mousedown.lg.zoom', function(e) {
|
|
345
|
+
|
|
346
|
+
// execute only on .lg-object
|
|
347
|
+
var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
|
|
348
|
+
|
|
349
|
+
allowY = $image.prop('offsetHeight') * $image.attr('data-scale') > _this.core.$outer.find('.lg').height();
|
|
350
|
+
allowX = $image.prop('offsetWidth') * $image.attr('data-scale') > _this.core.$outer.find('.lg').width();
|
|
351
|
+
|
|
352
|
+
if (_this.core.$outer.hasClass('lg-zoomed')) {
|
|
353
|
+
if ($(e.target).hasClass('lg-object') && (allowX || allowY)) {
|
|
354
|
+
e.preventDefault();
|
|
355
|
+
startCoords = {
|
|
356
|
+
x: e.pageX,
|
|
357
|
+
y: e.pageY
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
isDraging = true;
|
|
361
|
+
|
|
362
|
+
// ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
|
|
363
|
+
_this.core.$outer.scrollLeft += 1;
|
|
364
|
+
_this.core.$outer.scrollLeft -= 1;
|
|
365
|
+
|
|
366
|
+
_this.core.$outer.removeClass('lg-grab').addClass('lg-grabbing');
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
$(window).on('mousemove.lg.zoom', function(e) {
|
|
372
|
+
if (isDraging) {
|
|
373
|
+
var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
|
|
374
|
+
var distanceX;
|
|
375
|
+
var distanceY;
|
|
376
|
+
|
|
377
|
+
isMoved = true;
|
|
378
|
+
endCoords = {
|
|
379
|
+
x: e.pageX,
|
|
380
|
+
y: e.pageY
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
// reset opacity and transition duration
|
|
384
|
+
_this.core.$outer.addClass('lg-zoom-dragging');
|
|
385
|
+
|
|
386
|
+
if (allowY) {
|
|
387
|
+
distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
|
|
388
|
+
} else {
|
|
389
|
+
distanceY = -Math.abs(_$el.attr('data-y'));
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
if (allowX) {
|
|
393
|
+
distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
|
|
394
|
+
} else {
|
|
395
|
+
distanceX = -Math.abs(_$el.attr('data-x'));
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
_$el.css({
|
|
399
|
+
left: distanceX + 'px',
|
|
400
|
+
top: distanceY + 'px'
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
$(window).on('mouseup.lg.zoom', function(e) {
|
|
406
|
+
|
|
407
|
+
if (isDraging) {
|
|
408
|
+
isDraging = false;
|
|
409
|
+
_this.core.$outer.removeClass('lg-zoom-dragging');
|
|
410
|
+
|
|
411
|
+
// Fix for chrome mouse move on click
|
|
412
|
+
if (isMoved && ((startCoords.x !== endCoords.x) || (startCoords.y !== endCoords.y))) {
|
|
413
|
+
endCoords = {
|
|
414
|
+
x: e.pageX,
|
|
415
|
+
y: e.pageY
|
|
416
|
+
};
|
|
417
|
+
_this.touchendZoom(startCoords, endCoords, allowX, allowY);
|
|
418
|
+
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
isMoved = false;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
_this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab');
|
|
425
|
+
|
|
426
|
+
});
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
Zoom.prototype.touchendZoom = function(startCoords, endCoords, allowX, allowY) {
|
|
430
|
+
|
|
431
|
+
var _this = this;
|
|
432
|
+
var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
|
|
433
|
+
var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
|
|
434
|
+
var distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
|
|
435
|
+
var distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
|
|
436
|
+
var minY = (_this.core.$outer.find('.lg').height() - $image.prop('offsetHeight')) / 2;
|
|
437
|
+
var maxY = Math.abs(($image.prop('offsetHeight') * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').height() + minY);
|
|
438
|
+
var minX = (_this.core.$outer.find('.lg').width() - $image.prop('offsetWidth')) / 2;
|
|
439
|
+
var maxX = Math.abs(($image.prop('offsetWidth') * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').width() + minX);
|
|
440
|
+
|
|
441
|
+
if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
|
|
442
|
+
if (allowY) {
|
|
443
|
+
if (distanceY <= -maxY) {
|
|
444
|
+
distanceY = -maxY;
|
|
445
|
+
} else if (distanceY >= -minY) {
|
|
446
|
+
distanceY = -minY;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
if (allowX) {
|
|
451
|
+
if (distanceX <= -maxX) {
|
|
452
|
+
distanceX = -maxX;
|
|
453
|
+
} else if (distanceX >= -minX) {
|
|
454
|
+
distanceX = -minX;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
if (allowY) {
|
|
459
|
+
_$el.attr('data-y', Math.abs(distanceY));
|
|
460
|
+
} else {
|
|
461
|
+
distanceY = -Math.abs(_$el.attr('data-y'));
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
if (allowX) {
|
|
465
|
+
_$el.attr('data-x', Math.abs(distanceX));
|
|
466
|
+
} else {
|
|
467
|
+
distanceX = -Math.abs(_$el.attr('data-x'));
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
_$el.css({
|
|
471
|
+
left: distanceX + 'px',
|
|
472
|
+
top: distanceY + 'px'
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
Zoom.prototype.destroy = function() {
|
|
479
|
+
|
|
480
|
+
var _this = this;
|
|
481
|
+
|
|
482
|
+
// Unbind all events added by lightGallery zoom plugin
|
|
483
|
+
_this.core.$el.off('.lg.zoom');
|
|
484
|
+
$(window).off('.lg.zoom');
|
|
485
|
+
_this.core.$slide.off('.lg.zoom');
|
|
486
|
+
_this.core.$el.off('.lg.tm.zoom');
|
|
487
|
+
_this.resetZoom();
|
|
488
|
+
clearTimeout(_this.zoomabletimeout);
|
|
489
|
+
_this.zoomabletimeout = false;
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
$.fn.lightGallery.modules.zoom = Zoom;
|
|
493
|
+
|
|
494
|
+
})();
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
}));
|