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