lightgallery-rails 1.4.2 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/lib/lightgallery/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/{lightgallery.autoplay.js → lg-autoplay.js} +0 -0
  4. data/vendor/assets/javascripts/{lightgallery.autoplay.min.js → lg-autoplay.min.js} +0 -0
  5. data/vendor/assets/javascripts/{lightgallery.fullscreen.js → lg-fullscreen.js} +8 -8
  6. data/vendor/assets/javascripts/lg-fullscreen.min.js +4 -0
  7. data/vendor/assets/javascripts/{lightgallery.hash.js → lg-hash.js} +0 -0
  8. data/vendor/assets/javascripts/{lightgallery.hash.min.js → lg-hash.min.js} +0 -0
  9. data/vendor/assets/javascripts/{lightgallery.pager.js → lg-pager.js} +0 -0
  10. data/vendor/assets/javascripts/{lightgallery.pager.min.js → lg-pager.min.js} +0 -0
  11. data/vendor/assets/javascripts/{lightgallery.share.js → lg-share.js} +0 -0
  12. data/vendor/assets/javascripts/{lightgallery.share.min.js → lg-share.min.js} +0 -0
  13. data/vendor/assets/javascripts/{lightgallery.thumbnail.js → lg-thumbnail.js} +10 -5
  14. data/vendor/assets/javascripts/lg-thumbnail.min.js +4 -0
  15. data/vendor/assets/javascripts/{lightgallery.video.js → lg-video.js} +2 -2
  16. data/vendor/assets/javascripts/{lightgallery.video.min.js → lg-video.min.js} +2 -2
  17. data/vendor/assets/javascripts/{lightgallery.zoom.js → lg-zoom.js} +4 -8
  18. data/vendor/assets/javascripts/lg-zoom.min.js +4 -0
  19. data/vendor/assets/javascripts/lightgallery-all.js +3317 -0
  20. data/vendor/assets/javascripts/lightgallery-all.min.js +5 -0
  21. data/vendor/assets/javascripts/lightgallery.js +3 -4
  22. data/vendor/assets/javascripts/lightgallery.min.js +2 -2
  23. metadata +20 -18
  24. data/vendor/assets/javascripts/lightgallery.fullscreen.min.js +0 -4
  25. data/vendor/assets/javascripts/lightgallery.thumbnail.min.js +0 -4
  26. data/vendor/assets/javascripts/lightgallery.zoom.min.js +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27c759421c7ac37b0608018106f4a439dc3cc175
4
- data.tar.gz: 5143f5690615af515ca47d484cb7acf198ce4aa5
3
+ metadata.gz: 46b2bc2e749f6c551d9e030e893dccee215375d8
4
+ data.tar.gz: 5284c1cc760781a13902049299a3f9b196c2bb01
5
5
  SHA512:
6
- metadata.gz: 0a437a6ac911ddb5fc2e19f8dc098db75aa4a9cd213dc2663553c8ec08c0c93298d82ad43fb98d3fe53e2b41a6f68811d9ed2d10936b972eea58d06f60508195
7
- data.tar.gz: c6388414ebe7e4475f185d58ff5eafe04b2f3fd045b37efd02ad8349050543132e002e2cf0aa2dc4d970e269c66298033be4d088c2448c50c6d33ca3a37ee15d
6
+ metadata.gz: 61d4a73c690f9ae5cd5a1635b86c5e783faf50efeac8161c3a1fa5d5c2d52b10f589855a479d3a074571d9b12a6a5807af13a791341901f89bc52946d6c201c9
7
+ data.tar.gz: 26794ef2f75b25a5bed59a8778619331d92023e7b61600513ef79b72c41cb9efb680f64dbef741bf65e1c563a5d3fae6d7bdac7aee7c409ed7c661437983ba01
@@ -1,5 +1,5 @@
1
1
  module Lightgallery
2
2
  module Rails
3
- VERSION = "1.4.2".freeze
3
+ VERSION = "1.6.0".freeze
4
4
  end
5
5
  end
@@ -1,24 +1,24 @@
1
- /*! lg-fullscreen - v1.0.0 - 2016-09-20
1
+ /*! lg-fullscreen - v1.0.1 - 2016-09-30
2
2
  * http://sachinchoolur.github.io/lightGallery
3
3
  * Copyright (c) 2016 Sachin N; Licensed GPLv3 */
4
4
 
5
5
  (function (root, factory) {
6
6
  if (typeof define === 'function' && define.amd) {
7
7
  // AMD. Register as an anonymous module unless amdModuleId is set
8
- define([], function () {
9
- return (factory());
8
+ define(['jquery'], function (a0) {
9
+ return (factory(a0));
10
10
  });
11
11
  } else if (typeof exports === 'object') {
12
12
  // Node. Does not work with strict CommonJS, but
13
13
  // only CommonJS-like environments that support module.exports,
14
14
  // like Node.
15
- module.exports = factory();
15
+ module.exports = factory(require('jquery'));
16
16
  } else {
17
- factory();
17
+ factory(jQuery);
18
18
  }
19
- }(this, function () {
19
+ }(this, function ($) {
20
20
 
21
- (function($, window, document, undefined) {
21
+ (function() {
22
22
 
23
23
  'use strict';
24
24
 
@@ -111,6 +111,6 @@
111
111
 
112
112
  $.fn.lightGallery.modules.fullscreen = Fullscreen;
113
113
 
114
- })(jQuery, window, document);
114
+ })();
115
115
 
116
116
  }));
@@ -0,0 +1,4 @@
1
+ /*! lg-fullscreen - v1.0.1 - 2016-09-30
2
+ * http://sachinchoolur.github.io/lightGallery
3
+ * Copyright (c) 2016 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={fullScreen:!0},c=function(c){return this.core=a(c).data("lightGallery"),this.$el=a(c),this.core.s=a.extend({},b,this.core.s),this.init(),this};c.prototype.init=function(){var a="";if(this.core.s.fullScreen){if(!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled))return;a='<span class="lg-fullscreen lg-icon"></span>',this.core.$outer.find(".lg-toolbar").append(a),this.fullScreen()}},c.prototype.requestFullscreen=function(){var a=document.documentElement;a.requestFullscreen?a.requestFullscreen():a.msRequestFullscreen?a.msRequestFullscreen():a.mozRequestFullScreen?a.mozRequestFullScreen():a.webkitRequestFullscreen&&a.webkitRequestFullscreen()},c.prototype.exitFullscreen=function(){document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},c.prototype.fullScreen=function(){var b=this;a(document).on("fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg",function(){b.core.$outer.toggleClass("lg-fullscreen-on")}),this.core.$outer.find(".lg-fullscreen").on("click.lg",function(){document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement?b.exitFullscreen():b.requestFullscreen()})},c.prototype.destroy=function(){this.exitFullscreen(),a(document).off("fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg")},a.fn.lightGallery.modules.fullscreen=c}()});
@@ -1,4 +1,4 @@
1
- /*! lg-thumbnail - v1.0.3 - 2017-02-05
1
+ /*! lg-thumbnail - v1.1.0 - 2017-08-08
2
2
  * http://sachinchoolur.github.io/lightGallery
3
3
  * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
4
4
 
@@ -29,6 +29,7 @@
29
29
  currentPagerPosition: 'middle',
30
30
 
31
31
  thumbWidth: 100,
32
+ thumbHeight: '80px',
32
33
  thumbContHeight: 100,
33
34
  thumbMargin: 5,
34
35
 
@@ -64,6 +65,10 @@
64
65
  this.thumbTotalWidth = (this.core.$items.length * (this.core.s.thumbWidth + this.core.s.thumbMargin));
65
66
  this.thumbIndex = this.core.index;
66
67
 
68
+ if (this.core.s.animateThumb) {
69
+ this.core.s.thumbHeight = '100%';
70
+ }
71
+
67
72
  // Thumbnail animation value
68
73
  this.left = 0;
69
74
 
@@ -86,12 +91,12 @@
86
91
  }
87
92
 
88
93
  this.build();
89
- if (this.core.s.animateThumb) {
90
- if (this.core.s.enableThumbDrag && !this.core.isTouch && this.core.doCss()) {
94
+ if (this.core.s.animateThumb && this.core.doCss()) {
95
+ if (this.core.s.enableThumbDrag) {
91
96
  this.enableThumbDrag();
92
97
  }
93
98
 
94
- if (this.core.s.enableThumbSwipe && this.core.isTouch && this.core.doCss()) {
99
+ if (this.core.s.enableThumbSwipe) {
95
100
  this.enableThumbSwipe();
96
101
  }
97
102
 
@@ -174,7 +179,7 @@
174
179
  thumbImg = thumb;
175
180
  }
176
181
 
177
- thumbList += '<div data-vimeo-id="' + vimeoId + '" class="lg-thumb-item" style="width:' + _this.core.s.thumbWidth + 'px; margin-right: ' + _this.core.s.thumbMargin + 'px"><img src="' + thumbImg + '" /></div>';
182
+ thumbList += '<div data-vimeo-id="' + vimeoId + '" class="lg-thumb-item" style="width:' + _this.core.s.thumbWidth + 'px; height: ' + _this.core.s.thumbHeight + '; margin-right: ' + _this.core.s.thumbMargin + 'px"><img src="' + thumbImg + '" /></div>';
178
183
  vimeoId = '';
179
184
  }
180
185
 
@@ -0,0 +1,4 @@
1
+ /*! lg-thumbnail - v1.1.0 - 2017-08-08
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,thumbHeight:"80px",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.core.s.animateThumb&&(this.core.s.thumbHeight="100%"),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.doCss()?(this.core.s.enableThumbDrag&&this.enableThumbDrag(),this.core.s.enableThumbSwipe&&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; height: "+d.core.s.thumbHeight+"; 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}()});
@@ -1,4 +1,4 @@
1
- /*! lg-video - v1.0.2 - 2017-06-04
1
+ /*! lg-video - v1.1.0 - 2017-08-08
2
2
  * http://sachinchoolur.github.io/lightGallery
3
3
  * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
4
4
 
@@ -173,7 +173,7 @@
173
173
  }
174
174
  };
175
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))) {
176
+ if (_this.core.doCss() && (_this.core.$items.length > 1) && (_this.core.s.enableSwipe || _this.core.s.enableDrag)) {
177
177
  _this.core.$el.on('onSlideClick.lg.tm', function() {
178
178
  var $el = _this.core.$slide.eq(_this.core.index);
179
179
  loadOnClick($el);
@@ -1,4 +1,4 @@
1
- /*! lg-video - v1.0.2 - 2017-06-04
1
+ /*! lg-video - v1.1.0 - 2017-08-08
2
2
  * http://sachinchoolur.github.io/lightGallery
3
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}()});
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.s.enableDrag)?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}()});
@@ -1,6 +1,6 @@
1
- /*! lg-zoom - v1.0.4 - 2016-12-20
1
+ /*! lg-zoom - v1.1.0 - 2017-08-08
2
2
  * http://sachinchoolur.github.io/lightGallery
3
- * Copyright (c) 2016 Sachin N; Licensed GPLv3 */
3
+ * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
4
4
 
5
5
  (function (root, factory) {
6
6
  if (typeof define === 'function' && define.amd) {
@@ -242,13 +242,9 @@
242
242
  });
243
243
 
244
244
  // Drag option after zoom
245
- if (!_this.core.isTouch) {
246
- _this.zoomDrag();
247
- }
245
+ _this.zoomDrag();
248
246
 
249
- if (_this.core.isTouch) {
250
- _this.zoomSwipe();
251
- }
247
+ _this.zoomSwipe();
252
248
 
253
249
  };
254
250
 
@@ -0,0 +1,4 @@
1
+ /*! lg-zoom - v1.1.0 - 2017-08-08
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=function(){var a=!1,b=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);return b&&parseInt(b[2],10)<54&&(a=!0),a},c={scale:1,zoom:!0,actualSize:!0,enableZoomAfter:300,useLeftForZoom:b()},d=function(b){return this.core=a(b).data("lightGallery"),this.core.s=a.extend({},c,this.core.s),this.core.s.zoom&&this.core.doCss()&&(this.init(),this.zoomabletimeout=!1,this.pageX=a(window).width()/2,this.pageY=a(window).height()/2+a(window).scrollTop()),this};d.prototype.init=function(){var b=this,c='<span id="lg-zoom-in" class="lg-icon"></span><span id="lg-zoom-out" class="lg-icon"></span>';b.core.s.actualSize&&(c+='<span id="lg-actual-size" class="lg-icon"></span>'),b.core.s.useLeftForZoom?b.core.$outer.addClass("lg-use-left-for-zoom"):b.core.$outer.addClass("lg-use-transition-for-zoom"),this.core.$outer.find(".lg-toolbar").append(c),b.core.$el.on("onSlideItemLoad.lg.tm.zoom",function(c,d,e){var f=b.core.s.enableZoomAfter+e;a("body").hasClass("lg-from-hash")&&e?f=0:a("body").removeClass("lg-from-hash"),b.zoomabletimeout=setTimeout(function(){b.core.$slide.eq(d).addClass("lg-zoomable")},f+30)});var d=1,e=function(c){var d,e,f=b.core.$outer.find(".lg-current .lg-image"),g=(a(window).width()-f.prop("offsetWidth"))/2,h=(a(window).height()-f.prop("offsetHeight"))/2+a(window).scrollTop();d=b.pageX-g,e=b.pageY-h;var i=(c-1)*d,j=(c-1)*e;f.css("transform","scale3d("+c+", "+c+", 1)").attr("data-scale",c),b.core.s.useLeftForZoom?f.parent().css({left:-i+"px",top:-j+"px"}).attr("data-x",i).attr("data-y",j):f.parent().css("transform","translate3d(-"+i+"px, -"+j+"px, 0)").attr("data-x",i).attr("data-y",j)},f=function(){d>1?b.core.$outer.addClass("lg-zoomed"):b.resetZoom(),d<1&&(d=1),e(d)},g=function(c,e,g,h){var i,j=e.prop("offsetWidth");i=b.core.s.dynamic?b.core.s.dynamicEl[g].width||e[0].naturalWidth||j:b.core.$items.eq(g).attr("data-width")||e[0].naturalWidth||j;var k;b.core.$outer.hasClass("lg-zoomed")?d=1:i>j&&(k=i/j,d=k||2),h?(b.pageX=a(window).width()/2,b.pageY=a(window).height()/2+a(window).scrollTop()):(b.pageX=c.pageX||c.originalEvent.targetTouches[0].pageX,b.pageY=c.pageY||c.originalEvent.targetTouches[0].pageY),f(),setTimeout(function(){b.core.$outer.removeClass("lg-grabbing").addClass("lg-grab")},10)},h=!1;b.core.$el.on("onAferAppendSlide.lg.tm.zoom",function(a,c){var d=b.core.$slide.eq(c).find(".lg-image");d.on("dblclick",function(a){g(a,d,c)}),d.on("touchstart",function(a){h?(clearTimeout(h),h=null,g(a,d,c)):h=setTimeout(function(){h=null},300),a.preventDefault()})}),a(window).on("resize.lg.zoom scroll.lg.zoom orientationchange.lg.zoom",function(){b.pageX=a(window).width()/2,b.pageY=a(window).height()/2+a(window).scrollTop(),e(d)}),a("#lg-zoom-out").on("click.lg",function(){b.core.$outer.find(".lg-current .lg-image").length&&(d-=b.core.s.scale,f())}),a("#lg-zoom-in").on("click.lg",function(){b.core.$outer.find(".lg-current .lg-image").length&&(d+=b.core.s.scale,f())}),a("#lg-actual-size").on("click.lg",function(a){g(a,b.core.$slide.eq(b.core.index).find(".lg-image"),b.core.index,!0)}),b.core.$el.on("onBeforeSlide.lg.tm",function(){d=1,b.resetZoom()}),b.zoomDrag(),b.zoomSwipe()},d.prototype.resetZoom=function(){this.core.$outer.removeClass("lg-zoomed"),this.core.$slide.find(".lg-img-wrap").removeAttr("style data-x data-y"),this.core.$slide.find(".lg-image").removeAttr("style data-scale"),this.pageX=a(window).width()/2,this.pageY=a(window).height()/2+a(window).scrollTop()},d.prototype.zoomSwipe=function(){var a=this,b={},c={},d=!1,e=!1,f=!1;a.core.$slide.on("touchstart.lg",function(c){if(a.core.$outer.hasClass("lg-zoomed")){var d=a.core.$slide.eq(a.core.index).find(".lg-object");f=d.prop("offsetHeight")*d.attr("data-scale")>a.core.$outer.find(".lg").height(),e=d.prop("offsetWidth")*d.attr("data-scale")>a.core.$outer.find(".lg").width(),(e||f)&&(c.preventDefault(),b={x:c.originalEvent.targetTouches[0].pageX,y:c.originalEvent.targetTouches[0].pageY})}}),a.core.$slide.on("touchmove.lg",function(g){if(a.core.$outer.hasClass("lg-zoomed")){var h,i,j=a.core.$slide.eq(a.core.index).find(".lg-img-wrap");g.preventDefault(),d=!0,c={x:g.originalEvent.targetTouches[0].pageX,y:g.originalEvent.targetTouches[0].pageY},a.core.$outer.addClass("lg-zoom-dragging"),i=f?-Math.abs(j.attr("data-y"))+(c.y-b.y):-Math.abs(j.attr("data-y")),h=e?-Math.abs(j.attr("data-x"))+(c.x-b.x):-Math.abs(j.attr("data-x")),(Math.abs(c.x-b.x)>15||Math.abs(c.y-b.y)>15)&&(a.core.s.useLeftForZoom?j.css({left:h+"px",top:i+"px"}):j.css("transform","translate3d("+h+"px, "+i+"px, 0)"))}}),a.core.$slide.on("touchend.lg",function(){a.core.$outer.hasClass("lg-zoomed")&&d&&(d=!1,a.core.$outer.removeClass("lg-zoom-dragging"),a.touchendZoom(b,c,e,f))})},d.prototype.zoomDrag=function(){var b=this,c={},d={},e=!1,f=!1,g=!1,h=!1;b.core.$slide.on("mousedown.lg.zoom",function(d){var f=b.core.$slide.eq(b.core.index).find(".lg-object");h=f.prop("offsetHeight")*f.attr("data-scale")>b.core.$outer.find(".lg").height(),g=f.prop("offsetWidth")*f.attr("data-scale")>b.core.$outer.find(".lg").width(),b.core.$outer.hasClass("lg-zoomed")&&a(d.target).hasClass("lg-object")&&(g||h)&&(d.preventDefault(),c={x:d.pageX,y:d.pageY},e=!0,b.core.$outer.scrollLeft+=1,b.core.$outer.scrollLeft-=1,b.core.$outer.removeClass("lg-grab").addClass("lg-grabbing"))}),a(window).on("mousemove.lg.zoom",function(a){if(e){var i,j,k=b.core.$slide.eq(b.core.index).find(".lg-img-wrap");f=!0,d={x:a.pageX,y:a.pageY},b.core.$outer.addClass("lg-zoom-dragging"),j=h?-Math.abs(k.attr("data-y"))+(d.y-c.y):-Math.abs(k.attr("data-y")),i=g?-Math.abs(k.attr("data-x"))+(d.x-c.x):-Math.abs(k.attr("data-x")),b.core.s.useLeftForZoom?k.css({left:i+"px",top:j+"px"}):k.css("transform","translate3d("+i+"px, "+j+"px, 0)")}}),a(window).on("mouseup.lg.zoom",function(a){e&&(e=!1,b.core.$outer.removeClass("lg-zoom-dragging"),!f||c.x===d.x&&c.y===d.y||(d={x:a.pageX,y:a.pageY},b.touchendZoom(c,d,g,h)),f=!1),b.core.$outer.removeClass("lg-grabbing").addClass("lg-grab")})},d.prototype.touchendZoom=function(a,b,c,d){var e=this,f=e.core.$slide.eq(e.core.index).find(".lg-img-wrap"),g=e.core.$slide.eq(e.core.index).find(".lg-object"),h=-Math.abs(f.attr("data-x"))+(b.x-a.x),i=-Math.abs(f.attr("data-y"))+(b.y-a.y),j=(e.core.$outer.find(".lg").height()-g.prop("offsetHeight"))/2,k=Math.abs(g.prop("offsetHeight")*Math.abs(g.attr("data-scale"))-e.core.$outer.find(".lg").height()+j),l=(e.core.$outer.find(".lg").width()-g.prop("offsetWidth"))/2,m=Math.abs(g.prop("offsetWidth")*Math.abs(g.attr("data-scale"))-e.core.$outer.find(".lg").width()+l);(Math.abs(b.x-a.x)>15||Math.abs(b.y-a.y)>15)&&(d&&(i<=-k?i=-k:i>=-j&&(i=-j)),c&&(h<=-m?h=-m:h>=-l&&(h=-l)),d?f.attr("data-y",Math.abs(i)):i=-Math.abs(f.attr("data-y")),c?f.attr("data-x",Math.abs(h)):h=-Math.abs(f.attr("data-x")),e.core.s.useLeftForZoom?f.css({left:h+"px",top:i+"px"}):f.css("transform","translate3d("+h+"px, "+i+"px, 0)"))},d.prototype.destroy=function(){var b=this;b.core.$el.off(".lg.zoom"),a(window).off(".lg.zoom"),b.core.$slide.off(".lg.zoom"),b.core.$el.off(".lg.tm.zoom"),b.resetZoom(),clearTimeout(b.zoomabletimeout),b.zoomabletimeout=!1},a.fn.lightGallery.modules.zoom=d}()});
@@ -0,0 +1,3317 @@
1
+ /*! lightgallery - v1.6.0 - 2017-08-08
2
+ * http://sachinchoolur.github.io/lightGallery/
3
+ * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
4
+ /*! lightgallery - v1.6.0 - 2017-08-08
5
+ * http://sachinchoolur.github.io/lightGallery/
6
+ * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
7
+ (function (root, factory) {
8
+ if (typeof define === 'function' && define.amd) {
9
+ // AMD. Register as an anonymous module unless amdModuleId is set
10
+ define(['jquery'], function (a0) {
11
+ return (factory(a0));
12
+ });
13
+ } else if (typeof exports === 'object') {
14
+ // Node. Does not work with strict CommonJS, but
15
+ // only CommonJS-like environments that support module.exports,
16
+ // like Node.
17
+ module.exports = factory(require('jquery'));
18
+ } else {
19
+ factory(root["jQuery"]);
20
+ }
21
+ }(this, function ($) {
22
+
23
+ (function() {
24
+ 'use strict';
25
+
26
+ var defaults = {
27
+
28
+ mode: 'lg-slide',
29
+
30
+ // Ex : 'ease'
31
+ cssEasing: 'ease',
32
+
33
+ //'for jquery animation'
34
+ easing: 'linear',
35
+ speed: 600,
36
+ height: '100%',
37
+ width: '100%',
38
+ addClass: '',
39
+ startClass: 'lg-start-zoom',
40
+ backdropDuration: 150,
41
+ hideBarsDelay: 6000,
42
+
43
+ useLeft: false,
44
+
45
+ closable: true,
46
+ loop: true,
47
+ escKey: true,
48
+ keyPress: true,
49
+ controls: true,
50
+ slideEndAnimatoin: true,
51
+ hideControlOnEnd: false,
52
+ mousewheel: true,
53
+
54
+ getCaptionFromTitleOrAlt: true,
55
+
56
+ // .lg-item || '.lg-sub-html'
57
+ appendSubHtmlTo: '.lg-sub-html',
58
+
59
+ subHtmlSelectorRelative: false,
60
+
61
+ /**
62
+ * @desc number of preload slides
63
+ * will exicute only after the current slide is fully loaded.
64
+ *
65
+ * @ex you clicked on 4th image and if preload = 1 then 3rd slide and 5th
66
+ * slide will be loaded in the background after the 4th slide is fully loaded..
67
+ * if preload is 2 then 2nd 3rd 5th 6th slides will be preloaded.. ... ...
68
+ *
69
+ */
70
+ preload: 1,
71
+ showAfterLoad: true,
72
+ selector: '',
73
+ selectWithin: '',
74
+ nextHtml: '',
75
+ prevHtml: '',
76
+
77
+ // 0, 1
78
+ index: false,
79
+
80
+ iframeMaxWidth: '100%',
81
+
82
+ download: true,
83
+ counter: true,
84
+ appendCounterTo: '.lg-toolbar',
85
+
86
+ swipeThreshold: 50,
87
+ enableSwipe: true,
88
+ enableDrag: true,
89
+
90
+ dynamic: false,
91
+ dynamicEl: [],
92
+ galleryId: 1
93
+ };
94
+
95
+ function Plugin(element, options) {
96
+
97
+ // Current lightGallery element
98
+ this.el = element;
99
+
100
+ // Current jquery element
101
+ this.$el = $(element);
102
+
103
+ // lightGallery settings
104
+ this.s = $.extend({}, defaults, options);
105
+
106
+ // When using dynamic mode, ensure dynamicEl is an array
107
+ if (this.s.dynamic && this.s.dynamicEl !== 'undefined' && this.s.dynamicEl.constructor === Array && !this.s.dynamicEl.length) {
108
+ throw ('When using dynamic mode, you must also define dynamicEl as an Array.');
109
+ }
110
+
111
+ // lightGallery modules
112
+ this.modules = {};
113
+
114
+ // false when lightgallery complete first slide;
115
+ this.lGalleryOn = false;
116
+
117
+ this.lgBusy = false;
118
+
119
+ // Timeout function for hiding controls;
120
+ this.hideBartimeout = false;
121
+
122
+ // To determine browser supports for touch events;
123
+ this.isTouch = ('ontouchstart' in document.documentElement);
124
+
125
+ // Disable hideControlOnEnd if sildeEndAnimation is true
126
+ if (this.s.slideEndAnimatoin) {
127
+ this.s.hideControlOnEnd = false;
128
+ }
129
+
130
+ // Gallery items
131
+ if (this.s.dynamic) {
132
+ this.$items = this.s.dynamicEl;
133
+ } else {
134
+ if (this.s.selector === 'this') {
135
+ this.$items = this.$el;
136
+ } else if (this.s.selector !== '') {
137
+ if (this.s.selectWithin) {
138
+ this.$items = $(this.s.selectWithin).find(this.s.selector);
139
+ } else {
140
+ this.$items = this.$el.find($(this.s.selector));
141
+ }
142
+ } else {
143
+ this.$items = this.$el.children();
144
+ }
145
+ }
146
+
147
+ // .lg-item
148
+ this.$slide = '';
149
+
150
+ // .lg-outer
151
+ this.$outer = '';
152
+
153
+ this.init();
154
+
155
+ return this;
156
+ }
157
+
158
+ Plugin.prototype.init = function() {
159
+
160
+ var _this = this;
161
+
162
+ // s.preload should not be more than $item.length
163
+ if (_this.s.preload > _this.$items.length) {
164
+ _this.s.preload = _this.$items.length;
165
+ }
166
+
167
+ // if dynamic option is enabled execute immediately
168
+ var _hash = window.location.hash;
169
+ if (_hash.indexOf('lg=' + this.s.galleryId) > 0) {
170
+
171
+ _this.index = parseInt(_hash.split('&slide=')[1], 10);
172
+
173
+ $('body').addClass('lg-from-hash');
174
+ if (!$('body').hasClass('lg-on')) {
175
+ setTimeout(function() {
176
+ _this.build(_this.index);
177
+ });
178
+
179
+ $('body').addClass('lg-on');
180
+ }
181
+ }
182
+
183
+ if (_this.s.dynamic) {
184
+
185
+ _this.$el.trigger('onBeforeOpen.lg');
186
+
187
+ _this.index = _this.s.index || 0;
188
+
189
+ // prevent accidental double execution
190
+ if (!$('body').hasClass('lg-on')) {
191
+ setTimeout(function() {
192
+ _this.build(_this.index);
193
+ $('body').addClass('lg-on');
194
+ });
195
+ }
196
+ } else {
197
+
198
+ // Using different namespace for click because click event should not unbind if selector is same object('this')
199
+ _this.$items.on('click.lgcustom', function(event) {
200
+
201
+ // For IE8
202
+ try {
203
+ event.preventDefault();
204
+ event.preventDefault();
205
+ } catch (er) {
206
+ event.returnValue = false;
207
+ }
208
+
209
+ _this.$el.trigger('onBeforeOpen.lg');
210
+
211
+ _this.index = _this.s.index || _this.$items.index(this);
212
+
213
+ // prevent accidental double execution
214
+ if (!$('body').hasClass('lg-on')) {
215
+ _this.build(_this.index);
216
+ $('body').addClass('lg-on');
217
+ }
218
+ });
219
+ }
220
+
221
+ };
222
+
223
+ Plugin.prototype.build = function(index) {
224
+
225
+ var _this = this;
226
+
227
+ _this.structure();
228
+
229
+ // module constructor
230
+ $.each($.fn.lightGallery.modules, function(key) {
231
+ _this.modules[key] = new $.fn.lightGallery.modules[key](_this.el);
232
+ });
233
+
234
+ // initiate slide function
235
+ _this.slide(index, false, false, false);
236
+
237
+ if (_this.s.keyPress) {
238
+ _this.keyPress();
239
+ }
240
+
241
+ if (_this.$items.length > 1) {
242
+
243
+ _this.arrow();
244
+
245
+ setTimeout(function() {
246
+ _this.enableDrag();
247
+ _this.enableSwipe();
248
+ }, 50);
249
+
250
+ if (_this.s.mousewheel) {
251
+ _this.mousewheel();
252
+ }
253
+ } else {
254
+ _this.$slide.on('click.lg', function() {
255
+ _this.$el.trigger('onSlideClick.lg');
256
+ });
257
+ }
258
+
259
+ _this.counter();
260
+
261
+ _this.closeGallery();
262
+
263
+ _this.$el.trigger('onAfterOpen.lg');
264
+
265
+ // Hide controllers if mouse doesn't move for some period
266
+ _this.$outer.on('mousemove.lg click.lg touchstart.lg', function() {
267
+
268
+ _this.$outer.removeClass('lg-hide-items');
269
+
270
+ clearTimeout(_this.hideBartimeout);
271
+
272
+ // Timeout will be cleared on each slide movement also
273
+ _this.hideBartimeout = setTimeout(function() {
274
+ _this.$outer.addClass('lg-hide-items');
275
+ }, _this.s.hideBarsDelay);
276
+
277
+ });
278
+
279
+ _this.$outer.trigger('mousemove.lg');
280
+
281
+ };
282
+
283
+ Plugin.prototype.structure = function() {
284
+ var list = '';
285
+ var controls = '';
286
+ var i = 0;
287
+ var subHtmlCont = '';
288
+ var template;
289
+ var _this = this;
290
+
291
+ $('body').append('<div class="lg-backdrop"></div>');
292
+ $('.lg-backdrop').css('transition-duration', this.s.backdropDuration + 'ms');
293
+
294
+ // Create gallery items
295
+ for (i = 0; i < this.$items.length; i++) {
296
+ list += '<div class="lg-item"></div>';
297
+ }
298
+
299
+ // Create controlls
300
+ if (this.s.controls && this.$items.length > 1) {
301
+ controls = '<div class="lg-actions">' +
302
+ '<button class="lg-prev lg-icon">' + this.s.prevHtml + '</button>' +
303
+ '<button class="lg-next lg-icon">' + this.s.nextHtml + '</button>' +
304
+ '</div>';
305
+ }
306
+
307
+ if (this.s.appendSubHtmlTo === '.lg-sub-html') {
308
+ subHtmlCont = '<div class="lg-sub-html"></div>';
309
+ }
310
+
311
+ template = '<div class="lg-outer ' + this.s.addClass + ' ' + this.s.startClass + '">' +
312
+ '<div class="lg" style="width:' + this.s.width + '; height:' + this.s.height + '">' +
313
+ '<div class="lg-inner">' + list + '</div>' +
314
+ '<div class="lg-toolbar lg-group">' +
315
+ '<span class="lg-close lg-icon"></span>' +
316
+ '</div>' +
317
+ controls +
318
+ subHtmlCont +
319
+ '</div>' +
320
+ '</div>';
321
+
322
+ $('body').append(template);
323
+ this.$outer = $('.lg-outer');
324
+ this.$slide = this.$outer.find('.lg-item');
325
+
326
+ if (this.s.useLeft) {
327
+ this.$outer.addClass('lg-use-left');
328
+
329
+ // Set mode lg-slide if use left is true;
330
+ this.s.mode = 'lg-slide';
331
+ } else {
332
+ this.$outer.addClass('lg-use-css3');
333
+ }
334
+
335
+ // For fixed height gallery
336
+ _this.setTop();
337
+ $(window).on('resize.lg orientationchange.lg', function() {
338
+ setTimeout(function() {
339
+ _this.setTop();
340
+ }, 100);
341
+ });
342
+
343
+ // add class lg-current to remove initial transition
344
+ this.$slide.eq(this.index).addClass('lg-current');
345
+
346
+ // add Class for css support and transition mode
347
+ if (this.doCss()) {
348
+ this.$outer.addClass('lg-css3');
349
+ } else {
350
+ this.$outer.addClass('lg-css');
351
+
352
+ // Set speed 0 because no animation will happen if browser doesn't support css3
353
+ this.s.speed = 0;
354
+ }
355
+
356
+ this.$outer.addClass(this.s.mode);
357
+
358
+ if (this.s.enableDrag && this.$items.length > 1) {
359
+ this.$outer.addClass('lg-grab');
360
+ }
361
+
362
+ if (this.s.showAfterLoad) {
363
+ this.$outer.addClass('lg-show-after-load');
364
+ }
365
+
366
+ if (this.doCss()) {
367
+ var $inner = this.$outer.find('.lg-inner');
368
+ $inner.css('transition-timing-function', this.s.cssEasing);
369
+ $inner.css('transition-duration', this.s.speed + 'ms');
370
+ }
371
+
372
+ setTimeout(function() {
373
+ $('.lg-backdrop').addClass('in');
374
+ });
375
+
376
+ setTimeout(function() {
377
+ _this.$outer.addClass('lg-visible');
378
+ }, this.s.backdropDuration);
379
+
380
+ if (this.s.download) {
381
+ this.$outer.find('.lg-toolbar').append('<a id="lg-download" target="_blank" download class="lg-download lg-icon"></a>');
382
+ }
383
+
384
+ // Store the current scroll top value to scroll back after closing the gallery..
385
+ this.prevScrollTop = $(window).scrollTop();
386
+
387
+ };
388
+
389
+ // For fixed height gallery
390
+ Plugin.prototype.setTop = function() {
391
+ if (this.s.height !== '100%') {
392
+ var wH = $(window).height();
393
+ var top = (wH - parseInt(this.s.height, 10)) / 2;
394
+ var $lGallery = this.$outer.find('.lg');
395
+ if (wH >= parseInt(this.s.height, 10)) {
396
+ $lGallery.css('top', top + 'px');
397
+ } else {
398
+ $lGallery.css('top', '0px');
399
+ }
400
+ }
401
+ };
402
+
403
+ // Find css3 support
404
+ Plugin.prototype.doCss = function() {
405
+ // check for css animation support
406
+ var support = function() {
407
+ var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition'];
408
+ var root = document.documentElement;
409
+ var i = 0;
410
+ for (i = 0; i < transition.length; i++) {
411
+ if (transition[i] in root.style) {
412
+ return true;
413
+ }
414
+ }
415
+ };
416
+
417
+ if (support()) {
418
+ return true;
419
+ }
420
+
421
+ return false;
422
+ };
423
+
424
+ /**
425
+ * @desc Check the given src is video
426
+ * @param {String} src
427
+ * @return {Object} video type
428
+ * Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
429
+ */
430
+ Plugin.prototype.isVideo = function(src, index) {
431
+
432
+ var html;
433
+ if (this.s.dynamic) {
434
+ html = this.s.dynamicEl[index].html;
435
+ } else {
436
+ html = this.$items.eq(index).attr('data-html');
437
+ }
438
+
439
+ if (!src) {
440
+ if(html) {
441
+ return {
442
+ html5: true
443
+ };
444
+ } else {
445
+ console.error('lightGallery :- data-src is not pvovided on slide item ' + (index + 1) + '. Please make sure the selector property is properly configured. More info - http://sachinchoolur.github.io/lightGallery/demos/html-markup.html');
446
+ return false;
447
+ }
448
+ }
449
+
450
+ var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i);
451
+ var vimeo = src.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i);
452
+ var dailymotion = src.match(/\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i);
453
+ var vk = src.match(/\/\/(?:www\.)?(?:vk\.com|vkontakte\.ru)\/(?:video_ext\.php\?)(.*)/i);
454
+
455
+ if (youtube) {
456
+ return {
457
+ youtube: youtube
458
+ };
459
+ } else if (vimeo) {
460
+ return {
461
+ vimeo: vimeo
462
+ };
463
+ } else if (dailymotion) {
464
+ return {
465
+ dailymotion: dailymotion
466
+ };
467
+ } else if (vk) {
468
+ return {
469
+ vk: vk
470
+ };
471
+ }
472
+ };
473
+
474
+ /**
475
+ * @desc Create image counter
476
+ * Ex: 1/10
477
+ */
478
+ Plugin.prototype.counter = function() {
479
+ if (this.s.counter) {
480
+ $(this.s.appendCounterTo).append('<div id="lg-counter"><span id="lg-counter-current">' + (parseInt(this.index, 10) + 1) + '</span> / <span id="lg-counter-all">' + this.$items.length + '</span></div>');
481
+ }
482
+ };
483
+
484
+ /**
485
+ * @desc add sub-html into the slide
486
+ * @param {Number} index - index of the slide
487
+ */
488
+ Plugin.prototype.addHtml = function(index) {
489
+ var subHtml = null;
490
+ var subHtmlUrl;
491
+ var $currentEle;
492
+ if (this.s.dynamic) {
493
+ if (this.s.dynamicEl[index].subHtmlUrl) {
494
+ subHtmlUrl = this.s.dynamicEl[index].subHtmlUrl;
495
+ } else {
496
+ subHtml = this.s.dynamicEl[index].subHtml;
497
+ }
498
+ } else {
499
+ $currentEle = this.$items.eq(index);
500
+ if ($currentEle.attr('data-sub-html-url')) {
501
+ subHtmlUrl = $currentEle.attr('data-sub-html-url');
502
+ } else {
503
+ subHtml = $currentEle.attr('data-sub-html');
504
+ if (this.s.getCaptionFromTitleOrAlt && !subHtml) {
505
+ subHtml = $currentEle.attr('title') || $currentEle.find('img').first().attr('alt');
506
+ }
507
+ }
508
+ }
509
+
510
+ if (!subHtmlUrl) {
511
+ if (typeof subHtml !== 'undefined' && subHtml !== null) {
512
+
513
+ // get first letter of subhtml
514
+ // if first letter starts with . or # get the html form the jQuery object
515
+ var fL = subHtml.substring(0, 1);
516
+ if (fL === '.' || fL === '#') {
517
+ if (this.s.subHtmlSelectorRelative && !this.s.dynamic) {
518
+ subHtml = $currentEle.find(subHtml).html();
519
+ } else {
520
+ subHtml = $(subHtml).html();
521
+ }
522
+ }
523
+ } else {
524
+ subHtml = '';
525
+ }
526
+ }
527
+
528
+ if (this.s.appendSubHtmlTo === '.lg-sub-html') {
529
+
530
+ if (subHtmlUrl) {
531
+ this.$outer.find(this.s.appendSubHtmlTo).load(subHtmlUrl);
532
+ } else {
533
+ this.$outer.find(this.s.appendSubHtmlTo).html(subHtml);
534
+ }
535
+
536
+ } else {
537
+
538
+ if (subHtmlUrl) {
539
+ this.$slide.eq(index).load(subHtmlUrl);
540
+ } else {
541
+ this.$slide.eq(index).append(subHtml);
542
+ }
543
+ }
544
+
545
+ // Add lg-empty-html class if title doesn't exist
546
+ if (typeof subHtml !== 'undefined' && subHtml !== null) {
547
+ if (subHtml === '') {
548
+ this.$outer.find(this.s.appendSubHtmlTo).addClass('lg-empty-html');
549
+ } else {
550
+ this.$outer.find(this.s.appendSubHtmlTo).removeClass('lg-empty-html');
551
+ }
552
+ }
553
+
554
+ this.$el.trigger('onAfterAppendSubHtml.lg', [index]);
555
+ };
556
+
557
+ /**
558
+ * @desc Preload slides
559
+ * @param {Number} index - index of the slide
560
+ */
561
+ Plugin.prototype.preload = function(index) {
562
+ var i = 1;
563
+ var j = 1;
564
+ for (i = 1; i <= this.s.preload; i++) {
565
+ if (i >= this.$items.length - index) {
566
+ break;
567
+ }
568
+
569
+ this.loadContent(index + i, false, 0);
570
+ }
571
+
572
+ for (j = 1; j <= this.s.preload; j++) {
573
+ if (index - j < 0) {
574
+ break;
575
+ }
576
+
577
+ this.loadContent(index - j, false, 0);
578
+ }
579
+ };
580
+
581
+ /**
582
+ * @desc Load slide content into slide.
583
+ * @param {Number} index - index of the slide.
584
+ * @param {Boolean} rec - if true call loadcontent() function again.
585
+ * @param {Boolean} delay - delay for adding complete class. it is 0 except first time.
586
+ */
587
+ Plugin.prototype.loadContent = function(index, rec, delay) {
588
+
589
+ var _this = this;
590
+ var _hasPoster = false;
591
+ var _$img;
592
+ var _src;
593
+ var _poster;
594
+ var _srcset;
595
+ var _sizes;
596
+ var _html;
597
+ var getResponsiveSrc = function(srcItms) {
598
+ var rsWidth = [];
599
+ var rsSrc = [];
600
+ for (var i = 0; i < srcItms.length; i++) {
601
+ var __src = srcItms[i].split(' ');
602
+
603
+ // Manage empty space
604
+ if (__src[0] === '') {
605
+ __src.splice(0, 1);
606
+ }
607
+
608
+ rsSrc.push(__src[0]);
609
+ rsWidth.push(__src[1]);
610
+ }
611
+
612
+ var wWidth = $(window).width();
613
+ for (var j = 0; j < rsWidth.length; j++) {
614
+ if (parseInt(rsWidth[j], 10) > wWidth) {
615
+ _src = rsSrc[j];
616
+ break;
617
+ }
618
+ }
619
+ };
620
+
621
+ if (_this.s.dynamic) {
622
+
623
+ if (_this.s.dynamicEl[index].poster) {
624
+ _hasPoster = true;
625
+ _poster = _this.s.dynamicEl[index].poster;
626
+ }
627
+
628
+ _html = _this.s.dynamicEl[index].html;
629
+ _src = _this.s.dynamicEl[index].src;
630
+
631
+ if (_this.s.dynamicEl[index].responsive) {
632
+ var srcDyItms = _this.s.dynamicEl[index].responsive.split(',');
633
+ getResponsiveSrc(srcDyItms);
634
+ }
635
+
636
+ _srcset = _this.s.dynamicEl[index].srcset;
637
+ _sizes = _this.s.dynamicEl[index].sizes;
638
+
639
+ } else {
640
+
641
+ if (_this.$items.eq(index).attr('data-poster')) {
642
+ _hasPoster = true;
643
+ _poster = _this.$items.eq(index).attr('data-poster');
644
+ }
645
+
646
+ _html = _this.$items.eq(index).attr('data-html');
647
+ _src = _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src');
648
+
649
+ if (_this.$items.eq(index).attr('data-responsive')) {
650
+ var srcItms = _this.$items.eq(index).attr('data-responsive').split(',');
651
+ getResponsiveSrc(srcItms);
652
+ }
653
+
654
+ _srcset = _this.$items.eq(index).attr('data-srcset');
655
+ _sizes = _this.$items.eq(index).attr('data-sizes');
656
+
657
+ }
658
+
659
+ //if (_src || _srcset || _sizes || _poster) {
660
+
661
+ var iframe = false;
662
+ if (_this.s.dynamic) {
663
+ if (_this.s.dynamicEl[index].iframe) {
664
+ iframe = true;
665
+ }
666
+ } else {
667
+ if (_this.$items.eq(index).attr('data-iframe') === 'true') {
668
+ iframe = true;
669
+ }
670
+ }
671
+
672
+ var _isVideo = _this.isVideo(_src, index);
673
+ if (!_this.$slide.eq(index).hasClass('lg-loaded')) {
674
+ if (iframe) {
675
+ _this.$slide.eq(index).prepend('<div class="lg-video-cont lg-has-iframe" style="max-width:' + _this.s.iframeMaxWidth + '"><div class="lg-video"><iframe class="lg-object" frameborder="0" src="' + _src + '" allowfullscreen="true"></iframe></div></div>');
676
+ } else if (_hasPoster) {
677
+ var videoClass = '';
678
+ if (_isVideo && _isVideo.youtube) {
679
+ videoClass = 'lg-has-youtube';
680
+ } else if (_isVideo && _isVideo.vimeo) {
681
+ videoClass = 'lg-has-vimeo';
682
+ } else {
683
+ videoClass = 'lg-has-html5';
684
+ }
685
+
686
+ _this.$slide.eq(index).prepend('<div class="lg-video-cont ' + videoClass + ' "><div class="lg-video"><span class="lg-video-play"></span><img class="lg-object lg-has-poster" src="' + _poster + '" /></div></div>');
687
+
688
+ } else if (_isVideo) {
689
+ _this.$slide.eq(index).prepend('<div class="lg-video-cont "><div class="lg-video"></div></div>');
690
+ _this.$el.trigger('hasVideo.lg', [index, _src, _html]);
691
+ } else {
692
+ _this.$slide.eq(index).prepend('<div class="lg-img-wrap"><img class="lg-object lg-image" src="' + _src + '" /></div>');
693
+ }
694
+
695
+ _this.$el.trigger('onAferAppendSlide.lg', [index]);
696
+
697
+ _$img = _this.$slide.eq(index).find('.lg-object');
698
+ if (_sizes) {
699
+ _$img.attr('sizes', _sizes);
700
+ }
701
+
702
+ if (_srcset) {
703
+ _$img.attr('srcset', _srcset);
704
+ try {
705
+ picturefill({
706
+ elements: [_$img[0]]
707
+ });
708
+ } catch (e) {
709
+ console.warn('lightGallery :- If you want srcset to be supported for older browser please include picturefil version 2 javascript library in your document.');
710
+ }
711
+ }
712
+
713
+ if (this.s.appendSubHtmlTo !== '.lg-sub-html') {
714
+ _this.addHtml(index);
715
+ }
716
+
717
+ _this.$slide.eq(index).addClass('lg-loaded');
718
+ }
719
+
720
+ _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() {
721
+
722
+ // For first time add some delay for displaying the start animation.
723
+ var _speed = 0;
724
+
725
+ // Do not change the delay value because it is required for zoom plugin.
726
+ // If gallery opened from direct url (hash) speed value should be 0
727
+ if (delay && !$('body').hasClass('lg-from-hash')) {
728
+ _speed = delay;
729
+ }
730
+
731
+ setTimeout(function() {
732
+ _this.$slide.eq(index).addClass('lg-complete');
733
+ _this.$el.trigger('onSlideItemLoad.lg', [index, delay || 0]);
734
+ }, _speed);
735
+
736
+ });
737
+
738
+ // @todo check load state for html5 videos
739
+ if (_isVideo && _isVideo.html5 && !_hasPoster) {
740
+ _this.$slide.eq(index).addClass('lg-complete');
741
+ }
742
+
743
+ if (rec === true) {
744
+ if (!_this.$slide.eq(index).hasClass('lg-complete')) {
745
+ _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() {
746
+ _this.preload(index);
747
+ });
748
+ } else {
749
+ _this.preload(index);
750
+ }
751
+ }
752
+
753
+ //}
754
+ };
755
+
756
+ /**
757
+ * @desc slide function for lightgallery
758
+ ** Slide() gets call on start
759
+ ** ** Set lg.on true once slide() function gets called.
760
+ ** Call loadContent() on slide() function inside setTimeout
761
+ ** ** On first slide we do not want any animation like slide of fade
762
+ ** ** So on first slide( if lg.on if false that is first slide) loadContent() should start loading immediately
763
+ ** ** Else loadContent() should wait for the transition to complete.
764
+ ** ** So set timeout s.speed + 50
765
+ <=> ** loadContent() will load slide content in to the particular slide
766
+ ** ** It has recursion (rec) parameter. if rec === true loadContent() will call preload() function.
767
+ ** ** preload will execute only when the previous slide is fully loaded (images iframe)
768
+ ** ** avoid simultaneous image load
769
+ <=> ** Preload() will check for s.preload value and call loadContent() again accoring to preload value
770
+ ** loadContent() <====> Preload();
771
+
772
+ * @param {Number} index - index of the slide
773
+ * @param {Boolean} fromTouch - true if slide function called via touch event or mouse drag
774
+ * @param {Boolean} fromThumb - true if slide function called via thumbnail click
775
+ * @param {String} direction - Direction of the slide(next/prev)
776
+ */
777
+ Plugin.prototype.slide = function(index, fromTouch, fromThumb, direction) {
778
+
779
+ var _prevIndex = this.$outer.find('.lg-current').index();
780
+ var _this = this;
781
+
782
+ // Prevent if multiple call
783
+ // Required for hsh plugin
784
+ if (_this.lGalleryOn && (_prevIndex === index)) {
785
+ return;
786
+ }
787
+
788
+ var _length = this.$slide.length;
789
+ var _time = _this.lGalleryOn ? this.s.speed : 0;
790
+
791
+ if (!_this.lgBusy) {
792
+
793
+ if (this.s.download) {
794
+ var _src;
795
+ if (_this.s.dynamic) {
796
+ _src = _this.s.dynamicEl[index].downloadUrl !== false && (_this.s.dynamicEl[index].downloadUrl || _this.s.dynamicEl[index].src);
797
+ } else {
798
+ _src = _this.$items.eq(index).attr('data-download-url') !== 'false' && (_this.$items.eq(index).attr('data-download-url') || _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src'));
799
+
800
+ }
801
+
802
+ if (_src) {
803
+ $('#lg-download').attr('href', _src);
804
+ _this.$outer.removeClass('lg-hide-download');
805
+ } else {
806
+ _this.$outer.addClass('lg-hide-download');
807
+ }
808
+ }
809
+
810
+ this.$el.trigger('onBeforeSlide.lg', [_prevIndex, index, fromTouch, fromThumb]);
811
+
812
+ _this.lgBusy = true;
813
+
814
+ clearTimeout(_this.hideBartimeout);
815
+
816
+ // Add title if this.s.appendSubHtmlTo === lg-sub-html
817
+ if (this.s.appendSubHtmlTo === '.lg-sub-html') {
818
+
819
+ // wait for slide animation to complete
820
+ setTimeout(function() {
821
+ _this.addHtml(index);
822
+ }, _time);
823
+ }
824
+
825
+ this.arrowDisable(index);
826
+
827
+ if (!direction) {
828
+ if (index < _prevIndex) {
829
+ direction = 'prev';
830
+ } else if (index > _prevIndex) {
831
+ direction = 'next';
832
+ }
833
+ }
834
+
835
+ if (!fromTouch) {
836
+
837
+ // remove all transitions
838
+ _this.$outer.addClass('lg-no-trans');
839
+
840
+ this.$slide.removeClass('lg-prev-slide lg-next-slide');
841
+
842
+ if (direction === 'prev') {
843
+
844
+ //prevslide
845
+ this.$slide.eq(index).addClass('lg-prev-slide');
846
+ this.$slide.eq(_prevIndex).addClass('lg-next-slide');
847
+ } else {
848
+
849
+ // next slide
850
+ this.$slide.eq(index).addClass('lg-next-slide');
851
+ this.$slide.eq(_prevIndex).addClass('lg-prev-slide');
852
+ }
853
+
854
+ // give 50 ms for browser to add/remove class
855
+ setTimeout(function() {
856
+ _this.$slide.removeClass('lg-current');
857
+
858
+ //_this.$slide.eq(_prevIndex).removeClass('lg-current');
859
+ _this.$slide.eq(index).addClass('lg-current');
860
+
861
+ // reset all transitions
862
+ _this.$outer.removeClass('lg-no-trans');
863
+ }, 50);
864
+ } else {
865
+
866
+ this.$slide.removeClass('lg-prev-slide lg-current lg-next-slide');
867
+ var touchPrev;
868
+ var touchNext;
869
+ if (_length > 2) {
870
+ touchPrev = index - 1;
871
+ touchNext = index + 1;
872
+
873
+ if ((index === 0) && (_prevIndex === _length - 1)) {
874
+
875
+ // next slide
876
+ touchNext = 0;
877
+ touchPrev = _length - 1;
878
+ } else if ((index === _length - 1) && (_prevIndex === 0)) {
879
+
880
+ // prev slide
881
+ touchNext = 0;
882
+ touchPrev = _length - 1;
883
+ }
884
+
885
+ } else {
886
+ touchPrev = 0;
887
+ touchNext = 1;
888
+ }
889
+
890
+ if (direction === 'prev') {
891
+ _this.$slide.eq(touchNext).addClass('lg-next-slide');
892
+ } else {
893
+ _this.$slide.eq(touchPrev).addClass('lg-prev-slide');
894
+ }
895
+
896
+ _this.$slide.eq(index).addClass('lg-current');
897
+ }
898
+
899
+ if (_this.lGalleryOn) {
900
+ setTimeout(function() {
901
+ _this.loadContent(index, true, 0);
902
+ }, this.s.speed + 50);
903
+
904
+ setTimeout(function() {
905
+ _this.lgBusy = false;
906
+ _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]);
907
+ }, this.s.speed);
908
+
909
+ } else {
910
+ _this.loadContent(index, true, _this.s.backdropDuration);
911
+
912
+ _this.lgBusy = false;
913
+ _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]);
914
+ }
915
+
916
+ _this.lGalleryOn = true;
917
+
918
+ if (this.s.counter) {
919
+ $('#lg-counter-current').text(index + 1);
920
+ }
921
+
922
+ }
923
+
924
+ };
925
+
926
+ /**
927
+ * @desc Go to next slide
928
+ * @param {Boolean} fromTouch - true if slide function called via touch event
929
+ */
930
+ Plugin.prototype.goToNextSlide = function(fromTouch) {
931
+ var _this = this;
932
+ var _loop = _this.s.loop;
933
+ if (fromTouch && _this.$slide.length < 3) {
934
+ _loop = false;
935
+ }
936
+
937
+ if (!_this.lgBusy) {
938
+ if ((_this.index + 1) < _this.$slide.length) {
939
+ _this.index++;
940
+ _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]);
941
+ _this.slide(_this.index, fromTouch, false, 'next');
942
+ } else {
943
+ if (_loop) {
944
+ _this.index = 0;
945
+ _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]);
946
+ _this.slide(_this.index, fromTouch, false, 'next');
947
+ } else if (_this.s.slideEndAnimatoin && !fromTouch) {
948
+ _this.$outer.addClass('lg-right-end');
949
+ setTimeout(function() {
950
+ _this.$outer.removeClass('lg-right-end');
951
+ }, 400);
952
+ }
953
+ }
954
+ }
955
+ };
956
+
957
+ /**
958
+ * @desc Go to previous slide
959
+ * @param {Boolean} fromTouch - true if slide function called via touch event
960
+ */
961
+ Plugin.prototype.goToPrevSlide = function(fromTouch) {
962
+ var _this = this;
963
+ var _loop = _this.s.loop;
964
+ if (fromTouch && _this.$slide.length < 3) {
965
+ _loop = false;
966
+ }
967
+
968
+ if (!_this.lgBusy) {
969
+ if (_this.index > 0) {
970
+ _this.index--;
971
+ _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]);
972
+ _this.slide(_this.index, fromTouch, false, 'prev');
973
+ } else {
974
+ if (_loop) {
975
+ _this.index = _this.$items.length - 1;
976
+ _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]);
977
+ _this.slide(_this.index, fromTouch, false, 'prev');
978
+ } else if (_this.s.slideEndAnimatoin && !fromTouch) {
979
+ _this.$outer.addClass('lg-left-end');
980
+ setTimeout(function() {
981
+ _this.$outer.removeClass('lg-left-end');
982
+ }, 400);
983
+ }
984
+ }
985
+ }
986
+ };
987
+
988
+ Plugin.prototype.keyPress = function() {
989
+ var _this = this;
990
+ if (this.$items.length > 1) {
991
+ $(window).on('keyup.lg', function(e) {
992
+ if (_this.$items.length > 1) {
993
+ if (e.keyCode === 37) {
994
+ e.preventDefault();
995
+ _this.goToPrevSlide();
996
+ }
997
+
998
+ if (e.keyCode === 39) {
999
+ e.preventDefault();
1000
+ _this.goToNextSlide();
1001
+ }
1002
+ }
1003
+ });
1004
+ }
1005
+
1006
+ $(window).on('keydown.lg', function(e) {
1007
+ if (_this.s.escKey === true && e.keyCode === 27) {
1008
+ e.preventDefault();
1009
+ if (!_this.$outer.hasClass('lg-thumb-open')) {
1010
+ _this.destroy();
1011
+ } else {
1012
+ _this.$outer.removeClass('lg-thumb-open');
1013
+ }
1014
+ }
1015
+ });
1016
+ };
1017
+
1018
+ Plugin.prototype.arrow = function() {
1019
+ var _this = this;
1020
+ this.$outer.find('.lg-prev').on('click.lg', function() {
1021
+ _this.goToPrevSlide();
1022
+ });
1023
+
1024
+ this.$outer.find('.lg-next').on('click.lg', function() {
1025
+ _this.goToNextSlide();
1026
+ });
1027
+ };
1028
+
1029
+ Plugin.prototype.arrowDisable = function(index) {
1030
+
1031
+ // Disable arrows if s.hideControlOnEnd is true
1032
+ if (!this.s.loop && this.s.hideControlOnEnd) {
1033
+ if ((index + 1) < this.$slide.length) {
1034
+ this.$outer.find('.lg-next').removeAttr('disabled').removeClass('disabled');
1035
+ } else {
1036
+ this.$outer.find('.lg-next').attr('disabled', 'disabled').addClass('disabled');
1037
+ }
1038
+
1039
+ if (index > 0) {
1040
+ this.$outer.find('.lg-prev').removeAttr('disabled').removeClass('disabled');
1041
+ } else {
1042
+ this.$outer.find('.lg-prev').attr('disabled', 'disabled').addClass('disabled');
1043
+ }
1044
+ }
1045
+ };
1046
+
1047
+ Plugin.prototype.setTranslate = function($el, xValue, yValue) {
1048
+ // jQuery supports Automatic CSS prefixing since jQuery 1.8.0
1049
+ if (this.s.useLeft) {
1050
+ $el.css('left', xValue);
1051
+ } else {
1052
+ $el.css({
1053
+ transform: 'translate3d(' + (xValue) + 'px, ' + yValue + 'px, 0px)'
1054
+ });
1055
+ }
1056
+ };
1057
+
1058
+ Plugin.prototype.touchMove = function(startCoords, endCoords) {
1059
+
1060
+ var distance = endCoords - startCoords;
1061
+
1062
+ if (Math.abs(distance) > 15) {
1063
+ // reset opacity and transition duration
1064
+ this.$outer.addClass('lg-dragging');
1065
+
1066
+ // move current slide
1067
+ this.setTranslate(this.$slide.eq(this.index), distance, 0);
1068
+
1069
+ // move next and prev slide with current slide
1070
+ this.setTranslate($('.lg-prev-slide'), -this.$slide.eq(this.index).width() + distance, 0);
1071
+ this.setTranslate($('.lg-next-slide'), this.$slide.eq(this.index).width() + distance, 0);
1072
+ }
1073
+ };
1074
+
1075
+ Plugin.prototype.touchEnd = function(distance) {
1076
+ var _this = this;
1077
+
1078
+ // keep slide animation for any mode while dragg/swipe
1079
+ if (_this.s.mode !== 'lg-slide') {
1080
+ _this.$outer.addClass('lg-slide');
1081
+ }
1082
+
1083
+ this.$slide.not('.lg-current, .lg-prev-slide, .lg-next-slide').css('opacity', '0');
1084
+
1085
+ // set transition duration
1086
+ setTimeout(function() {
1087
+ _this.$outer.removeClass('lg-dragging');
1088
+ if ((distance < 0) && (Math.abs(distance) > _this.s.swipeThreshold)) {
1089
+ _this.goToNextSlide(true);
1090
+ } else if ((distance > 0) && (Math.abs(distance) > _this.s.swipeThreshold)) {
1091
+ _this.goToPrevSlide(true);
1092
+ } else if (Math.abs(distance) < 5) {
1093
+
1094
+ // Trigger click if distance is less than 5 pix
1095
+ _this.$el.trigger('onSlideClick.lg');
1096
+ }
1097
+
1098
+ _this.$slide.removeAttr('style');
1099
+ });
1100
+
1101
+ // remove slide class once drag/swipe is completed if mode is not slide
1102
+ setTimeout(function() {
1103
+ if (!_this.$outer.hasClass('lg-dragging') && _this.s.mode !== 'lg-slide') {
1104
+ _this.$outer.removeClass('lg-slide');
1105
+ }
1106
+ }, _this.s.speed + 100);
1107
+
1108
+ };
1109
+
1110
+ Plugin.prototype.enableSwipe = function() {
1111
+ var _this = this;
1112
+ var startCoords = 0;
1113
+ var endCoords = 0;
1114
+ var isMoved = false;
1115
+
1116
+ if (_this.s.enableSwipe && _this.doCss()) {
1117
+
1118
+ _this.$slide.on('touchstart.lg', function(e) {
1119
+ if (!_this.$outer.hasClass('lg-zoomed') && !_this.lgBusy) {
1120
+ e.preventDefault();
1121
+ _this.manageSwipeClass();
1122
+ startCoords = e.originalEvent.targetTouches[0].pageX;
1123
+ }
1124
+ });
1125
+
1126
+ _this.$slide.on('touchmove.lg', function(e) {
1127
+ if (!_this.$outer.hasClass('lg-zoomed')) {
1128
+ e.preventDefault();
1129
+ endCoords = e.originalEvent.targetTouches[0].pageX;
1130
+ _this.touchMove(startCoords, endCoords);
1131
+ isMoved = true;
1132
+ }
1133
+ });
1134
+
1135
+ _this.$slide.on('touchend.lg', function() {
1136
+ if (!_this.$outer.hasClass('lg-zoomed')) {
1137
+ if (isMoved) {
1138
+ isMoved = false;
1139
+ _this.touchEnd(endCoords - startCoords);
1140
+ } else {
1141
+ _this.$el.trigger('onSlideClick.lg');
1142
+ }
1143
+ }
1144
+ });
1145
+ }
1146
+
1147
+ };
1148
+
1149
+ Plugin.prototype.enableDrag = function() {
1150
+ var _this = this;
1151
+ var startCoords = 0;
1152
+ var endCoords = 0;
1153
+ var isDraging = false;
1154
+ var isMoved = false;
1155
+ if (_this.s.enableDrag && _this.doCss()) {
1156
+ _this.$slide.on('mousedown.lg', function(e) {
1157
+ // execute only on .lg-object
1158
+ if (!_this.$outer.hasClass('lg-zoomed')) {
1159
+ if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) {
1160
+ e.preventDefault();
1161
+
1162
+ if (!_this.lgBusy) {
1163
+ _this.manageSwipeClass();
1164
+ startCoords = e.pageX;
1165
+ isDraging = true;
1166
+
1167
+ // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
1168
+ _this.$outer.scrollLeft += 1;
1169
+ _this.$outer.scrollLeft -= 1;
1170
+
1171
+ // *
1172
+
1173
+ _this.$outer.removeClass('lg-grab').addClass('lg-grabbing');
1174
+
1175
+ _this.$el.trigger('onDragstart.lg');
1176
+ }
1177
+
1178
+ }
1179
+ }
1180
+ });
1181
+
1182
+ $(window).on('mousemove.lg', function(e) {
1183
+ if (isDraging) {
1184
+ isMoved = true;
1185
+ endCoords = e.pageX;
1186
+ _this.touchMove(startCoords, endCoords);
1187
+ _this.$el.trigger('onDragmove.lg');
1188
+ }
1189
+ });
1190
+
1191
+ $(window).on('mouseup.lg', function(e) {
1192
+ if (isMoved) {
1193
+ isMoved = false;
1194
+ _this.touchEnd(endCoords - startCoords);
1195
+ _this.$el.trigger('onDragend.lg');
1196
+ } else if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) {
1197
+ _this.$el.trigger('onSlideClick.lg');
1198
+ }
1199
+
1200
+ // Prevent execution on click
1201
+ if (isDraging) {
1202
+ isDraging = false;
1203
+ _this.$outer.removeClass('lg-grabbing').addClass('lg-grab');
1204
+ }
1205
+ });
1206
+
1207
+ }
1208
+ };
1209
+
1210
+ Plugin.prototype.manageSwipeClass = function() {
1211
+ var _touchNext = this.index + 1;
1212
+ var _touchPrev = this.index - 1;
1213
+ if (this.s.loop && this.$slide.length > 2) {
1214
+ if (this.index === 0) {
1215
+ _touchPrev = this.$slide.length - 1;
1216
+ } else if (this.index === this.$slide.length - 1) {
1217
+ _touchNext = 0;
1218
+ }
1219
+ }
1220
+
1221
+ this.$slide.removeClass('lg-next-slide lg-prev-slide');
1222
+ if (_touchPrev > -1) {
1223
+ this.$slide.eq(_touchPrev).addClass('lg-prev-slide');
1224
+ }
1225
+
1226
+ this.$slide.eq(_touchNext).addClass('lg-next-slide');
1227
+ };
1228
+
1229
+ Plugin.prototype.mousewheel = function() {
1230
+ var _this = this;
1231
+ _this.$outer.on('mousewheel.lg', function(e) {
1232
+
1233
+ if (!e.deltaY) {
1234
+ return;
1235
+ }
1236
+
1237
+ if (e.deltaY > 0) {
1238
+ _this.goToPrevSlide();
1239
+ } else {
1240
+ _this.goToNextSlide();
1241
+ }
1242
+
1243
+ e.preventDefault();
1244
+ });
1245
+
1246
+ };
1247
+
1248
+ Plugin.prototype.closeGallery = function() {
1249
+
1250
+ var _this = this;
1251
+ var mousedown = false;
1252
+ this.$outer.find('.lg-close').on('click.lg', function() {
1253
+ _this.destroy();
1254
+ });
1255
+
1256
+ if (_this.s.closable) {
1257
+
1258
+ // If you drag the slide and release outside gallery gets close on chrome
1259
+ // for preventing this check mousedown and mouseup happened on .lg-item or lg-outer
1260
+ _this.$outer.on('mousedown.lg', function(e) {
1261
+
1262
+ if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap')) {
1263
+ mousedown = true;
1264
+ } else {
1265
+ mousedown = false;
1266
+ }
1267
+
1268
+ });
1269
+
1270
+ _this.$outer.on('mouseup.lg', function(e) {
1271
+
1272
+ if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap') && mousedown) {
1273
+ if (!_this.$outer.hasClass('lg-dragging')) {
1274
+ _this.destroy();
1275
+ }
1276
+ }
1277
+
1278
+ });
1279
+
1280
+ }
1281
+
1282
+ };
1283
+
1284
+ Plugin.prototype.destroy = function(d) {
1285
+
1286
+ var _this = this;
1287
+
1288
+ if (!d) {
1289
+ _this.$el.trigger('onBeforeClose.lg');
1290
+ $(window).scrollTop(_this.prevScrollTop);
1291
+ }
1292
+
1293
+
1294
+ /**
1295
+ * if d is false or undefined destroy will only close the gallery
1296
+ * plugins instance remains with the element
1297
+ *
1298
+ * if d is true destroy will completely remove the plugin
1299
+ */
1300
+
1301
+ if (d) {
1302
+ if (!_this.s.dynamic) {
1303
+ // only when not using dynamic mode is $items a jquery collection
1304
+ this.$items.off('click.lg click.lgcustom');
1305
+ }
1306
+
1307
+ $.removeData(_this.el, 'lightGallery');
1308
+ }
1309
+
1310
+ // Unbind all events added by lightGallery
1311
+ this.$el.off('.lg.tm');
1312
+
1313
+ // Distroy all lightGallery modules
1314
+ $.each($.fn.lightGallery.modules, function(key) {
1315
+ if (_this.modules[key]) {
1316
+ _this.modules[key].destroy();
1317
+ }
1318
+ });
1319
+
1320
+ this.lGalleryOn = false;
1321
+
1322
+ clearTimeout(_this.hideBartimeout);
1323
+ this.hideBartimeout = false;
1324
+ $(window).off('.lg');
1325
+ $('body').removeClass('lg-on lg-from-hash');
1326
+
1327
+ if (_this.$outer) {
1328
+ _this.$outer.removeClass('lg-visible');
1329
+ }
1330
+
1331
+ $('.lg-backdrop').removeClass('in');
1332
+
1333
+ setTimeout(function() {
1334
+ if (_this.$outer) {
1335
+ _this.$outer.remove();
1336
+ }
1337
+
1338
+ $('.lg-backdrop').remove();
1339
+
1340
+ if (!d) {
1341
+ _this.$el.trigger('onCloseAfter.lg');
1342
+ }
1343
+
1344
+ }, _this.s.backdropDuration + 50);
1345
+ };
1346
+
1347
+ $.fn.lightGallery = function(options) {
1348
+ return this.each(function() {
1349
+ if (!$.data(this, 'lightGallery')) {
1350
+ $.data(this, 'lightGallery', new Plugin(this, options));
1351
+ } else {
1352
+ try {
1353
+ $(this).data('lightGallery').init();
1354
+ } catch (err) {
1355
+ console.error('lightGallery has not initiated properly');
1356
+ }
1357
+ }
1358
+ });
1359
+ };
1360
+
1361
+ $.fn.lightGallery.modules = {};
1362
+
1363
+ })();
1364
+
1365
+
1366
+ }));
1367
+
1368
+ /*! lg-autoplay - v1.0.4 - 2017-03-28
1369
+ * http://sachinchoolur.github.io/lightGallery
1370
+ * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
1371
+
1372
+ (function (root, factory) {
1373
+ if (typeof define === 'function' && define.amd) {
1374
+ // AMD. Register as an anonymous module unless amdModuleId is set
1375
+ define(['jquery'], function (a0) {
1376
+ return (factory(a0));
1377
+ });
1378
+ } else if (typeof exports === 'object') {
1379
+ // Node. Does not work with strict CommonJS, but
1380
+ // only CommonJS-like environments that support module.exports,
1381
+ // like Node.
1382
+ module.exports = factory(require('jquery'));
1383
+ } else {
1384
+ factory(jQuery);
1385
+ }
1386
+ }(this, function ($) {
1387
+
1388
+
1389
+ (function() {
1390
+
1391
+ 'use strict';
1392
+
1393
+ var defaults = {
1394
+ autoplay: false,
1395
+ pause: 5000,
1396
+ progressBar: true,
1397
+ fourceAutoplay: false,
1398
+ autoplayControls: true,
1399
+ appendAutoplayControlsTo: '.lg-toolbar'
1400
+ };
1401
+
1402
+ /**
1403
+ * Creates the autoplay plugin.
1404
+ * @param {object} element - lightGallery element
1405
+ */
1406
+ var Autoplay = function(element) {
1407
+
1408
+ this.core = $(element).data('lightGallery');
1409
+
1410
+ this.$el = $(element);
1411
+
1412
+ // Execute only if items are above 1
1413
+ if (this.core.$items.length < 2) {
1414
+ return false;
1415
+ }
1416
+
1417
+ this.core.s = $.extend({}, defaults, this.core.s);
1418
+ this.interval = false;
1419
+
1420
+ // Identify if slide happened from autoplay
1421
+ this.fromAuto = true;
1422
+
1423
+ // Identify if autoplay canceled from touch/drag
1424
+ this.canceledOnTouch = false;
1425
+
1426
+ // save fourceautoplay value
1427
+ this.fourceAutoplayTemp = this.core.s.fourceAutoplay;
1428
+
1429
+ // do not allow progress bar if browser does not support css3 transitions
1430
+ if (!this.core.doCss()) {
1431
+ this.core.s.progressBar = false;
1432
+ }
1433
+
1434
+ this.init();
1435
+
1436
+ return this;
1437
+ };
1438
+
1439
+ Autoplay.prototype.init = function() {
1440
+ var _this = this;
1441
+
1442
+ // append autoplay controls
1443
+ if (_this.core.s.autoplayControls) {
1444
+ _this.controls();
1445
+ }
1446
+
1447
+ // Create progress bar
1448
+ if (_this.core.s.progressBar) {
1449
+ _this.core.$outer.find('.lg').append('<div class="lg-progress-bar"><div class="lg-progress"></div></div>');
1450
+ }
1451
+
1452
+ // set progress
1453
+ _this.progress();
1454
+
1455
+ // Start autoplay
1456
+ if (_this.core.s.autoplay) {
1457
+ _this.$el.one('onSlideItemLoad.lg.tm', function() {
1458
+ _this.startlAuto();
1459
+ });
1460
+ }
1461
+
1462
+ // cancel interval on touchstart and dragstart
1463
+ _this.$el.on('onDragstart.lg.tm touchstart.lg.tm', function() {
1464
+ if (_this.interval) {
1465
+ _this.cancelAuto();
1466
+ _this.canceledOnTouch = true;
1467
+ }
1468
+ });
1469
+
1470
+ // restore autoplay if autoplay canceled from touchstart / dragstart
1471
+ _this.$el.on('onDragend.lg.tm touchend.lg.tm onSlideClick.lg.tm', function() {
1472
+ if (!_this.interval && _this.canceledOnTouch) {
1473
+ _this.startlAuto();
1474
+ _this.canceledOnTouch = false;
1475
+ }
1476
+ });
1477
+
1478
+ };
1479
+
1480
+ Autoplay.prototype.progress = function() {
1481
+
1482
+ var _this = this;
1483
+ var _$progressBar;
1484
+ var _$progress;
1485
+
1486
+ _this.$el.on('onBeforeSlide.lg.tm', function() {
1487
+
1488
+ // start progress bar animation
1489
+ if (_this.core.s.progressBar && _this.fromAuto) {
1490
+ _$progressBar = _this.core.$outer.find('.lg-progress-bar');
1491
+ _$progress = _this.core.$outer.find('.lg-progress');
1492
+ if (_this.interval) {
1493
+ _$progress.removeAttr('style');
1494
+ _$progressBar.removeClass('lg-start');
1495
+ setTimeout(function() {
1496
+ _$progress.css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
1497
+ _$progressBar.addClass('lg-start');
1498
+ }, 20);
1499
+ }
1500
+ }
1501
+
1502
+ // Remove setinterval if slide is triggered manually and fourceautoplay is false
1503
+ if (!_this.fromAuto && !_this.core.s.fourceAutoplay) {
1504
+ _this.cancelAuto();
1505
+ }
1506
+
1507
+ _this.fromAuto = false;
1508
+
1509
+ });
1510
+ };
1511
+
1512
+ // Manage autoplay via play/stop buttons
1513
+ Autoplay.prototype.controls = function() {
1514
+ var _this = this;
1515
+ var _html = '<span class="lg-autoplay-button lg-icon"></span>';
1516
+
1517
+ // Append autoplay controls
1518
+ $(this.core.s.appendAutoplayControlsTo).append(_html);
1519
+
1520
+ _this.core.$outer.find('.lg-autoplay-button').on('click.lg', function() {
1521
+ if ($(_this.core.$outer).hasClass('lg-show-autoplay')) {
1522
+ _this.cancelAuto();
1523
+ _this.core.s.fourceAutoplay = false;
1524
+ } else {
1525
+ if (!_this.interval) {
1526
+ _this.startlAuto();
1527
+ _this.core.s.fourceAutoplay = _this.fourceAutoplayTemp;
1528
+ }
1529
+ }
1530
+ });
1531
+ };
1532
+
1533
+ // Autostart gallery
1534
+ Autoplay.prototype.startlAuto = function() {
1535
+ var _this = this;
1536
+
1537
+ _this.core.$outer.find('.lg-progress').css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
1538
+ _this.core.$outer.addClass('lg-show-autoplay');
1539
+ _this.core.$outer.find('.lg-progress-bar').addClass('lg-start');
1540
+
1541
+ _this.interval = setInterval(function() {
1542
+ if (_this.core.index + 1 < _this.core.$items.length) {
1543
+ _this.core.index++;
1544
+ } else {
1545
+ _this.core.index = 0;
1546
+ }
1547
+
1548
+ _this.fromAuto = true;
1549
+ _this.core.slide(_this.core.index, false, false, 'next');
1550
+ }, _this.core.s.speed + _this.core.s.pause);
1551
+ };
1552
+
1553
+ // cancel Autostart
1554
+ Autoplay.prototype.cancelAuto = function() {
1555
+ clearInterval(this.interval);
1556
+ this.interval = false;
1557
+ this.core.$outer.find('.lg-progress').removeAttr('style');
1558
+ this.core.$outer.removeClass('lg-show-autoplay');
1559
+ this.core.$outer.find('.lg-progress-bar').removeClass('lg-start');
1560
+ };
1561
+
1562
+ Autoplay.prototype.destroy = function() {
1563
+
1564
+ this.cancelAuto();
1565
+ this.core.$outer.find('.lg-progress-bar').remove();
1566
+ };
1567
+
1568
+ $.fn.lightGallery.modules.autoplay = Autoplay;
1569
+
1570
+ })();
1571
+
1572
+
1573
+ }));
1574
+
1575
+ /*! lg-fullscreen - v1.0.1 - 2016-09-30
1576
+ * http://sachinchoolur.github.io/lightGallery
1577
+ * Copyright (c) 2016 Sachin N; Licensed GPLv3 */
1578
+
1579
+ (function (root, factory) {
1580
+ if (typeof define === 'function' && define.amd) {
1581
+ // AMD. Register as an anonymous module unless amdModuleId is set
1582
+ define(['jquery'], function (a0) {
1583
+ return (factory(a0));
1584
+ });
1585
+ } else if (typeof exports === 'object') {
1586
+ // Node. Does not work with strict CommonJS, but
1587
+ // only CommonJS-like environments that support module.exports,
1588
+ // like Node.
1589
+ module.exports = factory(require('jquery'));
1590
+ } else {
1591
+ factory(jQuery);
1592
+ }
1593
+ }(this, function ($) {
1594
+
1595
+ (function() {
1596
+
1597
+ 'use strict';
1598
+
1599
+ var defaults = {
1600
+ fullScreen: true
1601
+ };
1602
+
1603
+ var Fullscreen = function(element) {
1604
+
1605
+ // get lightGallery core plugin data
1606
+ this.core = $(element).data('lightGallery');
1607
+
1608
+ this.$el = $(element);
1609
+
1610
+ // extend module defalut settings with lightGallery core settings
1611
+ this.core.s = $.extend({}, defaults, this.core.s);
1612
+
1613
+ this.init();
1614
+
1615
+ return this;
1616
+ };
1617
+
1618
+ Fullscreen.prototype.init = function() {
1619
+ var fullScreen = '';
1620
+ if (this.core.s.fullScreen) {
1621
+
1622
+ // check for fullscreen browser support
1623
+ if (!document.fullscreenEnabled && !document.webkitFullscreenEnabled &&
1624
+ !document.mozFullScreenEnabled && !document.msFullscreenEnabled) {
1625
+ return;
1626
+ } else {
1627
+ fullScreen = '<span class="lg-fullscreen lg-icon"></span>';
1628
+ this.core.$outer.find('.lg-toolbar').append(fullScreen);
1629
+ this.fullScreen();
1630
+ }
1631
+ }
1632
+ };
1633
+
1634
+ Fullscreen.prototype.requestFullscreen = function() {
1635
+ var el = document.documentElement;
1636
+ if (el.requestFullscreen) {
1637
+ el.requestFullscreen();
1638
+ } else if (el.msRequestFullscreen) {
1639
+ el.msRequestFullscreen();
1640
+ } else if (el.mozRequestFullScreen) {
1641
+ el.mozRequestFullScreen();
1642
+ } else if (el.webkitRequestFullscreen) {
1643
+ el.webkitRequestFullscreen();
1644
+ }
1645
+ };
1646
+
1647
+ Fullscreen.prototype.exitFullscreen = function() {
1648
+ if (document.exitFullscreen) {
1649
+ document.exitFullscreen();
1650
+ } else if (document.msExitFullscreen) {
1651
+ document.msExitFullscreen();
1652
+ } else if (document.mozCancelFullScreen) {
1653
+ document.mozCancelFullScreen();
1654
+ } else if (document.webkitExitFullscreen) {
1655
+ document.webkitExitFullscreen();
1656
+ }
1657
+ };
1658
+
1659
+ // https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode
1660
+ Fullscreen.prototype.fullScreen = function() {
1661
+ var _this = this;
1662
+
1663
+ $(document).on('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg', function() {
1664
+ _this.core.$outer.toggleClass('lg-fullscreen-on');
1665
+ });
1666
+
1667
+ this.core.$outer.find('.lg-fullscreen').on('click.lg', function() {
1668
+ if (!document.fullscreenElement &&
1669
+ !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) {
1670
+ _this.requestFullscreen();
1671
+ } else {
1672
+ _this.exitFullscreen();
1673
+ }
1674
+ });
1675
+
1676
+ };
1677
+
1678
+ Fullscreen.prototype.destroy = function() {
1679
+
1680
+ // exit from fullscreen if activated
1681
+ this.exitFullscreen();
1682
+
1683
+ $(document).off('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg');
1684
+ };
1685
+
1686
+ $.fn.lightGallery.modules.fullscreen = Fullscreen;
1687
+
1688
+ })();
1689
+
1690
+ }));
1691
+
1692
+ /*! lg-pager - v1.0.2 - 2017-01-22
1693
+ * http://sachinchoolur.github.io/lightGallery
1694
+ * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
1695
+
1696
+ (function (root, factory) {
1697
+ if (typeof define === 'function' && define.amd) {
1698
+ // AMD. Register as an anonymous module unless amdModuleId is set
1699
+ define(['jquery'], function (a0) {
1700
+ return (factory(a0));
1701
+ });
1702
+ } else if (typeof exports === 'object') {
1703
+ // Node. Does not work with strict CommonJS, but
1704
+ // only CommonJS-like environments that support module.exports,
1705
+ // like Node.
1706
+ module.exports = factory(require('jquery'));
1707
+ } else {
1708
+ factory(jQuery);
1709
+ }
1710
+ }(this, function ($) {
1711
+
1712
+ (function() {
1713
+
1714
+ 'use strict';
1715
+
1716
+ var defaults = {
1717
+ pager: false
1718
+ };
1719
+
1720
+ var Pager = function(element) {
1721
+
1722
+ this.core = $(element).data('lightGallery');
1723
+
1724
+ this.$el = $(element);
1725
+ this.core.s = $.extend({}, defaults, this.core.s);
1726
+ if (this.core.s.pager && this.core.$items.length > 1) {
1727
+ this.init();
1728
+ }
1729
+
1730
+ return this;
1731
+ };
1732
+
1733
+ Pager.prototype.init = function() {
1734
+ var _this = this;
1735
+ var pagerList = '';
1736
+ var $pagerCont;
1737
+ var $pagerOuter;
1738
+ var timeout;
1739
+
1740
+ _this.core.$outer.find('.lg').append('<div class="lg-pager-outer"></div>');
1741
+
1742
+ if (_this.core.s.dynamic) {
1743
+ for (var i = 0; i < _this.core.s.dynamicEl.length; i++) {
1744
+ pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + _this.core.s.dynamicEl[i].thumb + '" /></div></span>';
1745
+ }
1746
+ } else {
1747
+ _this.core.$items.each(function() {
1748
+
1749
+ if (!_this.core.s.exThumbImage) {
1750
+ pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + $(this).find('img').attr('src') + '" /></div></span>';
1751
+ } else {
1752
+ pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + $(this).attr(_this.core.s.exThumbImage) + '" /></div></span>';
1753
+ }
1754
+
1755
+ });
1756
+ }
1757
+
1758
+ $pagerOuter = _this.core.$outer.find('.lg-pager-outer');
1759
+
1760
+ $pagerOuter.html(pagerList);
1761
+
1762
+ $pagerCont = _this.core.$outer.find('.lg-pager-cont');
1763
+ $pagerCont.on('click.lg touchend.lg', function() {
1764
+ var _$this = $(this);
1765
+ _this.core.index = _$this.index();
1766
+ _this.core.slide(_this.core.index, false, true, false);
1767
+ });
1768
+
1769
+ $pagerOuter.on('mouseover.lg', function() {
1770
+ clearTimeout(timeout);
1771
+ $pagerOuter.addClass('lg-pager-hover');
1772
+ });
1773
+
1774
+ $pagerOuter.on('mouseout.lg', function() {
1775
+ timeout = setTimeout(function() {
1776
+ $pagerOuter.removeClass('lg-pager-hover');
1777
+ });
1778
+ });
1779
+
1780
+ _this.core.$el.on('onBeforeSlide.lg.tm', function(e, prevIndex, index) {
1781
+ $pagerCont.removeClass('lg-pager-active');
1782
+ $pagerCont.eq(index).addClass('lg-pager-active');
1783
+ });
1784
+
1785
+ };
1786
+
1787
+ Pager.prototype.destroy = function() {
1788
+
1789
+ };
1790
+
1791
+ $.fn.lightGallery.modules.pager = Pager;
1792
+
1793
+ })();
1794
+
1795
+
1796
+ }));
1797
+
1798
+ /*! lg-thumbnail - v1.1.0 - 2017-08-08
1799
+ * http://sachinchoolur.github.io/lightGallery
1800
+ * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
1801
+
1802
+ (function (root, factory) {
1803
+ if (typeof define === 'function' && define.amd) {
1804
+ // AMD. Register as an anonymous module unless amdModuleId is set
1805
+ define(['jquery'], function (a0) {
1806
+ return (factory(a0));
1807
+ });
1808
+ } else if (typeof exports === 'object') {
1809
+ // Node. Does not work with strict CommonJS, but
1810
+ // only CommonJS-like environments that support module.exports,
1811
+ // like Node.
1812
+ module.exports = factory(require('jquery'));
1813
+ } else {
1814
+ factory(jQuery);
1815
+ }
1816
+ }(this, function ($) {
1817
+
1818
+ (function() {
1819
+
1820
+ 'use strict';
1821
+
1822
+ var defaults = {
1823
+ thumbnail: true,
1824
+
1825
+ animateThumb: true,
1826
+ currentPagerPosition: 'middle',
1827
+
1828
+ thumbWidth: 100,
1829
+ thumbHeight: '80px',
1830
+ thumbContHeight: 100,
1831
+ thumbMargin: 5,
1832
+
1833
+ exThumbImage: false,
1834
+ showThumbByDefault: true,
1835
+ toogleThumb: true,
1836
+ pullCaptionUp: true,
1837
+
1838
+ enableThumbDrag: true,
1839
+ enableThumbSwipe: true,
1840
+ swipeThreshold: 50,
1841
+
1842
+ loadYoutubeThumbnail: true,
1843
+ youtubeThumbSize: 1,
1844
+
1845
+ loadVimeoThumbnail: true,
1846
+ vimeoThumbSize: 'thumbnail_small',
1847
+
1848
+ loadDailymotionThumbnail: true
1849
+ };
1850
+
1851
+ var Thumbnail = function(element) {
1852
+
1853
+ // get lightGallery core plugin data
1854
+ this.core = $(element).data('lightGallery');
1855
+
1856
+ // extend module default settings with lightGallery core settings
1857
+ this.core.s = $.extend({}, defaults, this.core.s);
1858
+
1859
+ this.$el = $(element);
1860
+ this.$thumbOuter = null;
1861
+ this.thumbOuterWidth = 0;
1862
+ this.thumbTotalWidth = (this.core.$items.length * (this.core.s.thumbWidth + this.core.s.thumbMargin));
1863
+ this.thumbIndex = this.core.index;
1864
+
1865
+ if (this.core.s.animateThumb) {
1866
+ this.core.s.thumbHeight = '100%';
1867
+ }
1868
+
1869
+ // Thumbnail animation value
1870
+ this.left = 0;
1871
+
1872
+ this.init();
1873
+
1874
+ return this;
1875
+ };
1876
+
1877
+ Thumbnail.prototype.init = function() {
1878
+ var _this = this;
1879
+ if (this.core.s.thumbnail && this.core.$items.length > 1) {
1880
+ if (this.core.s.showThumbByDefault) {
1881
+ setTimeout(function(){
1882
+ _this.core.$outer.addClass('lg-thumb-open');
1883
+ }, 700);
1884
+ }
1885
+
1886
+ if (this.core.s.pullCaptionUp) {
1887
+ this.core.$outer.addClass('lg-pull-caption-up');
1888
+ }
1889
+
1890
+ this.build();
1891
+ if (this.core.s.animateThumb && this.core.doCss()) {
1892
+ if (this.core.s.enableThumbDrag) {
1893
+ this.enableThumbDrag();
1894
+ }
1895
+
1896
+ if (this.core.s.enableThumbSwipe) {
1897
+ this.enableThumbSwipe();
1898
+ }
1899
+
1900
+ this.thumbClickable = false;
1901
+ } else {
1902
+ this.thumbClickable = true;
1903
+ }
1904
+
1905
+ this.toogle();
1906
+ this.thumbkeyPress();
1907
+ }
1908
+ };
1909
+
1910
+ Thumbnail.prototype.build = function() {
1911
+ var _this = this;
1912
+ var thumbList = '';
1913
+ var vimeoErrorThumbSize = '';
1914
+ var $thumb;
1915
+ var html = '<div class="lg-thumb-outer">' +
1916
+ '<div class="lg-thumb lg-group">' +
1917
+ '</div>' +
1918
+ '</div>';
1919
+
1920
+ switch (this.core.s.vimeoThumbSize) {
1921
+ case 'thumbnail_large':
1922
+ vimeoErrorThumbSize = '640';
1923
+ break;
1924
+ case 'thumbnail_medium':
1925
+ vimeoErrorThumbSize = '200x150';
1926
+ break;
1927
+ case 'thumbnail_small':
1928
+ vimeoErrorThumbSize = '100x75';
1929
+ }
1930
+
1931
+ _this.core.$outer.addClass('lg-has-thumb');
1932
+
1933
+ _this.core.$outer.find('.lg').append(html);
1934
+
1935
+ _this.$thumbOuter = _this.core.$outer.find('.lg-thumb-outer');
1936
+ _this.thumbOuterWidth = _this.$thumbOuter.width();
1937
+
1938
+ if (_this.core.s.animateThumb) {
1939
+ _this.core.$outer.find('.lg-thumb').css({
1940
+ width: _this.thumbTotalWidth + 'px',
1941
+ position: 'relative'
1942
+ });
1943
+ }
1944
+
1945
+ if (this.core.s.animateThumb) {
1946
+ _this.$thumbOuter.css('height', _this.core.s.thumbContHeight + 'px');
1947
+ }
1948
+
1949
+ function getThumb(src, thumb, index) {
1950
+ var isVideo = _this.core.isVideo(src, index) || {};
1951
+ var thumbImg;
1952
+ var vimeoId = '';
1953
+
1954
+ if (isVideo.youtube || isVideo.vimeo || isVideo.dailymotion) {
1955
+ if (isVideo.youtube) {
1956
+ if (_this.core.s.loadYoutubeThumbnail) {
1957
+ thumbImg = '//img.youtube.com/vi/' + isVideo.youtube[1] + '/' + _this.core.s.youtubeThumbSize + '.jpg';
1958
+ } else {
1959
+ thumbImg = thumb;
1960
+ }
1961
+ } else if (isVideo.vimeo) {
1962
+ if (_this.core.s.loadVimeoThumbnail) {
1963
+ thumbImg = '//i.vimeocdn.com/video/error_' + vimeoErrorThumbSize + '.jpg';
1964
+ vimeoId = isVideo.vimeo[1];
1965
+ } else {
1966
+ thumbImg = thumb;
1967
+ }
1968
+ } else if (isVideo.dailymotion) {
1969
+ if (_this.core.s.loadDailymotionThumbnail) {
1970
+ thumbImg = '//www.dailymotion.com/thumbnail/video/' + isVideo.dailymotion[1];
1971
+ } else {
1972
+ thumbImg = thumb;
1973
+ }
1974
+ }
1975
+ } else {
1976
+ thumbImg = thumb;
1977
+ }
1978
+
1979
+ thumbList += '<div data-vimeo-id="' + vimeoId + '" class="lg-thumb-item" style="width:' + _this.core.s.thumbWidth + 'px; height: ' + _this.core.s.thumbHeight + '; margin-right: ' + _this.core.s.thumbMargin + 'px"><img src="' + thumbImg + '" /></div>';
1980
+ vimeoId = '';
1981
+ }
1982
+
1983
+ if (_this.core.s.dynamic) {
1984
+ for (var i = 0; i < _this.core.s.dynamicEl.length; i++) {
1985
+ getThumb(_this.core.s.dynamicEl[i].src, _this.core.s.dynamicEl[i].thumb, i);
1986
+ }
1987
+ } else {
1988
+ _this.core.$items.each(function(i) {
1989
+
1990
+ if (!_this.core.s.exThumbImage) {
1991
+ getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).find('img').attr('src'), i);
1992
+ } else {
1993
+ getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).attr(_this.core.s.exThumbImage), i);
1994
+ }
1995
+
1996
+ });
1997
+ }
1998
+
1999
+ _this.core.$outer.find('.lg-thumb').html(thumbList);
2000
+
2001
+ $thumb = _this.core.$outer.find('.lg-thumb-item');
2002
+
2003
+ // Load vimeo thumbnails
2004
+ $thumb.each(function() {
2005
+ var $this = $(this);
2006
+ var vimeoVideoId = $this.attr('data-vimeo-id');
2007
+
2008
+ if (vimeoVideoId) {
2009
+ $.getJSON('//www.vimeo.com/api/v2/video/' + vimeoVideoId + '.json?callback=?', {
2010
+ format: 'json'
2011
+ }, function(data) {
2012
+ $this.find('img').attr('src', data[0][_this.core.s.vimeoThumbSize]);
2013
+ });
2014
+ }
2015
+ });
2016
+
2017
+ // manage active class for thumbnail
2018
+ $thumb.eq(_this.core.index).addClass('active');
2019
+ _this.core.$el.on('onBeforeSlide.lg.tm', function() {
2020
+ $thumb.removeClass('active');
2021
+ $thumb.eq(_this.core.index).addClass('active');
2022
+ });
2023
+
2024
+ $thumb.on('click.lg touchend.lg', function() {
2025
+ var _$this = $(this);
2026
+ setTimeout(function() {
2027
+
2028
+ // In IE9 and bellow touch does not support
2029
+ // Go to slide if browser does not support css transitions
2030
+ if ((_this.thumbClickable && !_this.core.lgBusy) || !_this.core.doCss()) {
2031
+ _this.core.index = _$this.index();
2032
+ _this.core.slide(_this.core.index, false, true, false);
2033
+ }
2034
+ }, 50);
2035
+ });
2036
+
2037
+ _this.core.$el.on('onBeforeSlide.lg.tm', function() {
2038
+ _this.animateThumb(_this.core.index);
2039
+ });
2040
+
2041
+ $(window).on('resize.lg.thumb orientationchange.lg.thumb', function() {
2042
+ setTimeout(function() {
2043
+ _this.animateThumb(_this.core.index);
2044
+ _this.thumbOuterWidth = _this.$thumbOuter.width();
2045
+ }, 200);
2046
+ });
2047
+
2048
+ };
2049
+
2050
+ Thumbnail.prototype.setTranslate = function(value) {
2051
+ // jQuery supports Automatic CSS prefixing since jQuery 1.8.0
2052
+ this.core.$outer.find('.lg-thumb').css({
2053
+ transform: 'translate3d(-' + (value) + 'px, 0px, 0px)'
2054
+ });
2055
+ };
2056
+
2057
+ Thumbnail.prototype.animateThumb = function(index) {
2058
+ var $thumb = this.core.$outer.find('.lg-thumb');
2059
+ if (this.core.s.animateThumb) {
2060
+ var position;
2061
+ switch (this.core.s.currentPagerPosition) {
2062
+ case 'left':
2063
+ position = 0;
2064
+ break;
2065
+ case 'middle':
2066
+ position = (this.thumbOuterWidth / 2) - (this.core.s.thumbWidth / 2);
2067
+ break;
2068
+ case 'right':
2069
+ position = this.thumbOuterWidth - this.core.s.thumbWidth;
2070
+ }
2071
+ this.left = ((this.core.s.thumbWidth + this.core.s.thumbMargin) * index - 1) - position;
2072
+ if (this.left > (this.thumbTotalWidth - this.thumbOuterWidth)) {
2073
+ this.left = this.thumbTotalWidth - this.thumbOuterWidth;
2074
+ }
2075
+
2076
+ if (this.left < 0) {
2077
+ this.left = 0;
2078
+ }
2079
+
2080
+ if (this.core.lGalleryOn) {
2081
+ if (!$thumb.hasClass('on')) {
2082
+ this.core.$outer.find('.lg-thumb').css('transition-duration', this.core.s.speed + 'ms');
2083
+ }
2084
+
2085
+ if (!this.core.doCss()) {
2086
+ $thumb.animate({
2087
+ left: -this.left + 'px'
2088
+ }, this.core.s.speed);
2089
+ }
2090
+ } else {
2091
+ if (!this.core.doCss()) {
2092
+ $thumb.css('left', -this.left + 'px');
2093
+ }
2094
+ }
2095
+
2096
+ this.setTranslate(this.left);
2097
+
2098
+ }
2099
+ };
2100
+
2101
+ // Enable thumbnail dragging and swiping
2102
+ Thumbnail.prototype.enableThumbDrag = function() {
2103
+
2104
+ var _this = this;
2105
+ var startCoords = 0;
2106
+ var endCoords = 0;
2107
+ var isDraging = false;
2108
+ var isMoved = false;
2109
+ var tempLeft = 0;
2110
+
2111
+ _this.$thumbOuter.addClass('lg-grab');
2112
+
2113
+ _this.core.$outer.find('.lg-thumb').on('mousedown.lg.thumb', function(e) {
2114
+ if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
2115
+ // execute only on .lg-object
2116
+ e.preventDefault();
2117
+ startCoords = e.pageX;
2118
+ isDraging = true;
2119
+
2120
+ // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
2121
+ _this.core.$outer.scrollLeft += 1;
2122
+ _this.core.$outer.scrollLeft -= 1;
2123
+
2124
+ // *
2125
+ _this.thumbClickable = false;
2126
+ _this.$thumbOuter.removeClass('lg-grab').addClass('lg-grabbing');
2127
+ }
2128
+ });
2129
+
2130
+ $(window).on('mousemove.lg.thumb', function(e) {
2131
+ if (isDraging) {
2132
+ tempLeft = _this.left;
2133
+ isMoved = true;
2134
+ endCoords = e.pageX;
2135
+
2136
+ _this.$thumbOuter.addClass('lg-dragging');
2137
+
2138
+ tempLeft = tempLeft - (endCoords - startCoords);
2139
+
2140
+ if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) {
2141
+ tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
2142
+ }
2143
+
2144
+ if (tempLeft < 0) {
2145
+ tempLeft = 0;
2146
+ }
2147
+
2148
+ // move current slide
2149
+ _this.setTranslate(tempLeft);
2150
+
2151
+ }
2152
+ });
2153
+
2154
+ $(window).on('mouseup.lg.thumb', function() {
2155
+ if (isMoved) {
2156
+ isMoved = false;
2157
+ _this.$thumbOuter.removeClass('lg-dragging');
2158
+
2159
+ _this.left = tempLeft;
2160
+
2161
+ if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
2162
+ _this.thumbClickable = true;
2163
+ }
2164
+
2165
+ } else {
2166
+ _this.thumbClickable = true;
2167
+ }
2168
+
2169
+ if (isDraging) {
2170
+ isDraging = false;
2171
+ _this.$thumbOuter.removeClass('lg-grabbing').addClass('lg-grab');
2172
+ }
2173
+ });
2174
+
2175
+ };
2176
+
2177
+ Thumbnail.prototype.enableThumbSwipe = function() {
2178
+ var _this = this;
2179
+ var startCoords = 0;
2180
+ var endCoords = 0;
2181
+ var isMoved = false;
2182
+ var tempLeft = 0;
2183
+
2184
+ _this.core.$outer.find('.lg-thumb').on('touchstart.lg', function(e) {
2185
+ if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
2186
+ e.preventDefault();
2187
+ startCoords = e.originalEvent.targetTouches[0].pageX;
2188
+ _this.thumbClickable = false;
2189
+ }
2190
+ });
2191
+
2192
+ _this.core.$outer.find('.lg-thumb').on('touchmove.lg', function(e) {
2193
+ if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
2194
+ e.preventDefault();
2195
+ endCoords = e.originalEvent.targetTouches[0].pageX;
2196
+ isMoved = true;
2197
+
2198
+ _this.$thumbOuter.addClass('lg-dragging');
2199
+
2200
+ tempLeft = _this.left;
2201
+
2202
+ tempLeft = tempLeft - (endCoords - startCoords);
2203
+
2204
+ if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) {
2205
+ tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
2206
+ }
2207
+
2208
+ if (tempLeft < 0) {
2209
+ tempLeft = 0;
2210
+ }
2211
+
2212
+ // move current slide
2213
+ _this.setTranslate(tempLeft);
2214
+
2215
+ }
2216
+ });
2217
+
2218
+ _this.core.$outer.find('.lg-thumb').on('touchend.lg', function() {
2219
+ if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
2220
+
2221
+ if (isMoved) {
2222
+ isMoved = false;
2223
+ _this.$thumbOuter.removeClass('lg-dragging');
2224
+ if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
2225
+ _this.thumbClickable = true;
2226
+ }
2227
+
2228
+ _this.left = tempLeft;
2229
+ } else {
2230
+ _this.thumbClickable = true;
2231
+ }
2232
+ } else {
2233
+ _this.thumbClickable = true;
2234
+ }
2235
+ });
2236
+
2237
+ };
2238
+
2239
+ Thumbnail.prototype.toogle = function() {
2240
+ var _this = this;
2241
+ if (_this.core.s.toogleThumb) {
2242
+ _this.core.$outer.addClass('lg-can-toggle');
2243
+ _this.$thumbOuter.append('<span class="lg-toogle-thumb lg-icon"></span>');
2244
+ _this.core.$outer.find('.lg-toogle-thumb').on('click.lg', function() {
2245
+ _this.core.$outer.toggleClass('lg-thumb-open');
2246
+ });
2247
+ }
2248
+ };
2249
+
2250
+ Thumbnail.prototype.thumbkeyPress = function() {
2251
+ var _this = this;
2252
+ $(window).on('keydown.lg.thumb', function(e) {
2253
+ if (e.keyCode === 38) {
2254
+ e.preventDefault();
2255
+ _this.core.$outer.addClass('lg-thumb-open');
2256
+ } else if (e.keyCode === 40) {
2257
+ e.preventDefault();
2258
+ _this.core.$outer.removeClass('lg-thumb-open');
2259
+ }
2260
+ });
2261
+ };
2262
+
2263
+ Thumbnail.prototype.destroy = function() {
2264
+ if (this.core.s.thumbnail && this.core.$items.length > 1) {
2265
+ $(window).off('resize.lg.thumb orientationchange.lg.thumb keydown.lg.thumb');
2266
+ this.$thumbOuter.remove();
2267
+ this.core.$outer.removeClass('lg-has-thumb');
2268
+ }
2269
+ };
2270
+
2271
+ $.fn.lightGallery.modules.Thumbnail = Thumbnail;
2272
+
2273
+ })();
2274
+
2275
+ }));
2276
+
2277
+ /*! lg-video - v1.1.0 - 2017-08-08
2278
+ * http://sachinchoolur.github.io/lightGallery
2279
+ * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
2280
+
2281
+ (function (root, factory) {
2282
+ if (typeof define === 'function' && define.amd) {
2283
+ // AMD. Register as an anonymous module unless amdModuleId is set
2284
+ define(['jquery'], function (a0) {
2285
+ return (factory(a0));
2286
+ });
2287
+ } else if (typeof exports === 'object') {
2288
+ // Node. Does not work with strict CommonJS, but
2289
+ // only CommonJS-like environments that support module.exports,
2290
+ // like Node.
2291
+ module.exports = factory(require('jquery'));
2292
+ } else {
2293
+ factory(jQuery);
2294
+ }
2295
+ }(this, function ($) {
2296
+
2297
+ (function() {
2298
+
2299
+ 'use strict';
2300
+
2301
+ var defaults = {
2302
+ videoMaxWidth: '855px',
2303
+ youtubePlayerParams: false,
2304
+ vimeoPlayerParams: false,
2305
+ dailymotionPlayerParams: false,
2306
+ vkPlayerParams: false,
2307
+ videojs: false,
2308
+ videojsOptions: {}
2309
+ };
2310
+
2311
+ var Video = function(element) {
2312
+
2313
+ this.core = $(element).data('lightGallery');
2314
+
2315
+ this.$el = $(element);
2316
+ this.core.s = $.extend({}, defaults, this.core.s);
2317
+ this.videoLoaded = false;
2318
+
2319
+ this.init();
2320
+
2321
+ return this;
2322
+ };
2323
+
2324
+ Video.prototype.init = function() {
2325
+ var _this = this;
2326
+
2327
+ // Event triggered when video url found without poster
2328
+ _this.core.$el.on('hasVideo.lg.tm', function(event, index, src, html) {
2329
+ _this.core.$slide.eq(index).find('.lg-video').append(_this.loadVideo(src, 'lg-object', true, index, html));
2330
+ if (html) {
2331
+ if (_this.core.s.videojs) {
2332
+ try {
2333
+ videojs(_this.core.$slide.eq(index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() {
2334
+ if (!_this.videoLoaded) {
2335
+ this.play();
2336
+ }
2337
+ });
2338
+ } catch (e) {
2339
+ console.error('Make sure you have included videojs');
2340
+ }
2341
+ } else {
2342
+ if(!_this.videoLoaded) {
2343
+ _this.core.$slide.eq(index).find('.lg-html5').get(0).play();
2344
+ }
2345
+ }
2346
+ }
2347
+ });
2348
+
2349
+ // Set max width for video
2350
+ _this.core.$el.on('onAferAppendSlide.lg.tm', function(event, index) {
2351
+ var $videoCont = _this.core.$slide.eq(index).find('.lg-video-cont');
2352
+ if (!$videoCont.hasClass('lg-has-iframe')) {
2353
+ $videoCont.css('max-width', _this.core.s.videoMaxWidth);
2354
+ _this.videoLoaded = true;
2355
+ }
2356
+ });
2357
+
2358
+ var loadOnClick = function($el) {
2359
+ // check slide has poster
2360
+ if ($el.find('.lg-object').hasClass('lg-has-poster') && $el.find('.lg-object').is(':visible')) {
2361
+
2362
+ // check already video element present
2363
+ if (!$el.hasClass('lg-has-video')) {
2364
+
2365
+ $el.addClass('lg-video-playing lg-has-video');
2366
+
2367
+ var _src;
2368
+ var _html;
2369
+ var _loadVideo = function(_src, _html) {
2370
+
2371
+ $el.find('.lg-video').append(_this.loadVideo(_src, '', false, _this.core.index, _html));
2372
+
2373
+ if (_html) {
2374
+ if (_this.core.s.videojs) {
2375
+ try {
2376
+ videojs(_this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() {
2377
+ this.play();
2378
+ });
2379
+ } catch (e) {
2380
+ console.error('Make sure you have included videojs');
2381
+ }
2382
+ } else {
2383
+ _this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0).play();
2384
+ }
2385
+ }
2386
+
2387
+ };
2388
+
2389
+ if (_this.core.s.dynamic) {
2390
+
2391
+ _src = _this.core.s.dynamicEl[_this.core.index].src;
2392
+ _html = _this.core.s.dynamicEl[_this.core.index].html;
2393
+
2394
+ _loadVideo(_src, _html);
2395
+
2396
+ } else {
2397
+
2398
+ _src = _this.core.$items.eq(_this.core.index).attr('href') || _this.core.$items.eq(_this.core.index).attr('data-src');
2399
+ _html = _this.core.$items.eq(_this.core.index).attr('data-html');
2400
+
2401
+ _loadVideo(_src, _html);
2402
+
2403
+ }
2404
+
2405
+ var $tempImg = $el.find('.lg-object');
2406
+ $el.find('.lg-video').append($tempImg);
2407
+
2408
+ // @todo loading icon for html5 videos also
2409
+ // for showing the loading indicator while loading video
2410
+ if (!$el.find('.lg-video-object').hasClass('lg-html5')) {
2411
+ $el.removeClass('lg-complete');
2412
+ $el.find('.lg-video-object').on('load.lg error.lg', function() {
2413
+ $el.addClass('lg-complete');
2414
+ });
2415
+ }
2416
+
2417
+ } else {
2418
+
2419
+ var youtubePlayer = $el.find('.lg-youtube').get(0);
2420
+ var vimeoPlayer = $el.find('.lg-vimeo').get(0);
2421
+ var dailymotionPlayer = $el.find('.lg-dailymotion').get(0);
2422
+ var html5Player = $el.find('.lg-html5').get(0);
2423
+ if (youtubePlayer) {
2424
+ youtubePlayer.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
2425
+ } else if (vimeoPlayer) {
2426
+ try {
2427
+ $f(vimeoPlayer).api('play');
2428
+ } catch (e) {
2429
+ console.error('Make sure you have included froogaloop2 js');
2430
+ }
2431
+ } else if (dailymotionPlayer) {
2432
+ dailymotionPlayer.contentWindow.postMessage('play', '*');
2433
+
2434
+ } else if (html5Player) {
2435
+ if (_this.core.s.videojs) {
2436
+ try {
2437
+ videojs(html5Player).play();
2438
+ } catch (e) {
2439
+ console.error('Make sure you have included videojs');
2440
+ }
2441
+ } else {
2442
+ html5Player.play();
2443
+ }
2444
+ }
2445
+
2446
+ $el.addClass('lg-video-playing');
2447
+
2448
+ }
2449
+ }
2450
+ };
2451
+
2452
+ if (_this.core.doCss() && (_this.core.$items.length > 1) && (_this.core.s.enableSwipe || _this.core.s.enableDrag)) {
2453
+ _this.core.$el.on('onSlideClick.lg.tm', function() {
2454
+ var $el = _this.core.$slide.eq(_this.core.index);
2455
+ loadOnClick($el);
2456
+ });
2457
+ } else {
2458
+
2459
+ // For IE 9 and bellow
2460
+ _this.core.$slide.on('click.lg', function() {
2461
+ loadOnClick($(this));
2462
+ });
2463
+ }
2464
+
2465
+ _this.core.$el.on('onBeforeSlide.lg.tm', function(event, prevIndex, index) {
2466
+
2467
+ var $videoSlide = _this.core.$slide.eq(prevIndex);
2468
+ var youtubePlayer = $videoSlide.find('.lg-youtube').get(0);
2469
+ var vimeoPlayer = $videoSlide.find('.lg-vimeo').get(0);
2470
+ var dailymotionPlayer = $videoSlide.find('.lg-dailymotion').get(0);
2471
+ var vkPlayer = $videoSlide.find('.lg-vk').get(0);
2472
+ var html5Player = $videoSlide.find('.lg-html5').get(0);
2473
+ if (youtubePlayer) {
2474
+ youtubePlayer.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
2475
+ } else if (vimeoPlayer) {
2476
+ try {
2477
+ $f(vimeoPlayer).api('pause');
2478
+ } catch (e) {
2479
+ console.error('Make sure you have included froogaloop2 js');
2480
+ }
2481
+ } else if (dailymotionPlayer) {
2482
+ dailymotionPlayer.contentWindow.postMessage('pause', '*');
2483
+
2484
+ } else if (html5Player) {
2485
+ if (_this.core.s.videojs) {
2486
+ try {
2487
+ videojs(html5Player).pause();
2488
+ } catch (e) {
2489
+ console.error('Make sure you have included videojs');
2490
+ }
2491
+ } else {
2492
+ html5Player.pause();
2493
+ }
2494
+ } if (vkPlayer) {
2495
+ $(vkPlayer).attr('src', $(vkPlayer).attr('src').replace('&autoplay', '&noplay'));
2496
+ }
2497
+
2498
+ var _src;
2499
+ if (_this.core.s.dynamic) {
2500
+ _src = _this.core.s.dynamicEl[index].src;
2501
+ } else {
2502
+ _src = _this.core.$items.eq(index).attr('href') || _this.core.$items.eq(index).attr('data-src');
2503
+
2504
+ }
2505
+
2506
+ var _isVideo = _this.core.isVideo(_src, index) || {};
2507
+ if (_isVideo.youtube || _isVideo.vimeo || _isVideo.dailymotion || _isVideo.vk) {
2508
+ _this.core.$outer.addClass('lg-hide-download');
2509
+ }
2510
+
2511
+ //$videoSlide.addClass('lg-complete');
2512
+
2513
+ });
2514
+
2515
+ _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex) {
2516
+ _this.core.$slide.eq(prevIndex).removeClass('lg-video-playing');
2517
+ });
2518
+ };
2519
+
2520
+ Video.prototype.loadVideo = function(src, addClass, noposter, index, html) {
2521
+ var video = '';
2522
+ var autoplay = 1;
2523
+ var a = '';
2524
+ var isVideo = this.core.isVideo(src, index) || {};
2525
+
2526
+ // Enable autoplay for first video if poster doesn't exist
2527
+ if (noposter) {
2528
+ if (this.videoLoaded) {
2529
+ autoplay = 0;
2530
+ } else {
2531
+ autoplay = 1;
2532
+ }
2533
+ }
2534
+
2535
+ if (isVideo.youtube) {
2536
+
2537
+ a = '?wmode=opaque&autoplay=' + autoplay + '&enablejsapi=1';
2538
+ if (this.core.s.youtubePlayerParams) {
2539
+ a = a + '&' + $.param(this.core.s.youtubePlayerParams);
2540
+ }
2541
+
2542
+ 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>';
2543
+
2544
+ } else if (isVideo.vimeo) {
2545
+
2546
+ a = '?autoplay=' + autoplay + '&api=1';
2547
+ if (this.core.s.vimeoPlayerParams) {
2548
+ a = a + '&' + $.param(this.core.s.vimeoPlayerParams);
2549
+ }
2550
+
2551
+ 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>';
2552
+
2553
+ } else if (isVideo.dailymotion) {
2554
+
2555
+ a = '?wmode=opaque&autoplay=' + autoplay + '&api=postMessage';
2556
+ if (this.core.s.dailymotionPlayerParams) {
2557
+ a = a + '&' + $.param(this.core.s.dailymotionPlayerParams);
2558
+ }
2559
+
2560
+ 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>';
2561
+
2562
+ } else if (isVideo.html5) {
2563
+ var fL = html.substring(0, 1);
2564
+ if (fL === '.' || fL === '#') {
2565
+ html = $(html).html();
2566
+ }
2567
+
2568
+ video = html;
2569
+
2570
+ } else if (isVideo.vk) {
2571
+
2572
+ a = '&autoplay=' + autoplay;
2573
+ if (this.core.s.vkPlayerParams) {
2574
+ a = a + '&' + $.param(this.core.s.vkPlayerParams);
2575
+ }
2576
+
2577
+ 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>';
2578
+
2579
+ }
2580
+
2581
+ return video;
2582
+ };
2583
+
2584
+ Video.prototype.destroy = function() {
2585
+ this.videoLoaded = false;
2586
+ };
2587
+
2588
+ $.fn.lightGallery.modules.video = Video;
2589
+
2590
+ })();
2591
+
2592
+
2593
+ }));
2594
+
2595
+ /*! lg-zoom - v1.1.0 - 2017-08-08
2596
+ * http://sachinchoolur.github.io/lightGallery
2597
+ * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
2598
+
2599
+ (function (root, factory) {
2600
+ if (typeof define === 'function' && define.amd) {
2601
+ // AMD. Register as an anonymous module unless amdModuleId is set
2602
+ define(['jquery'], function (a0) {
2603
+ return (factory(a0));
2604
+ });
2605
+ } else if (typeof exports === 'object') {
2606
+ // Node. Does not work with strict CommonJS, but
2607
+ // only CommonJS-like environments that support module.exports,
2608
+ // like Node.
2609
+ module.exports = factory(require('jquery'));
2610
+ } else {
2611
+ factory(jQuery);
2612
+ }
2613
+ }(this, function ($) {
2614
+
2615
+ (function() {
2616
+
2617
+ 'use strict';
2618
+
2619
+ var getUseLeft = function() {
2620
+ var useLeft = false;
2621
+ var isChrome = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
2622
+ if (isChrome && parseInt(isChrome[2], 10) < 54) {
2623
+ useLeft = true;
2624
+ }
2625
+
2626
+ return useLeft;
2627
+ };
2628
+
2629
+ var defaults = {
2630
+ scale: 1,
2631
+ zoom: true,
2632
+ actualSize: true,
2633
+ enableZoomAfter: 300,
2634
+ useLeftForZoom: getUseLeft()
2635
+ };
2636
+
2637
+ var Zoom = function(element) {
2638
+
2639
+ this.core = $(element).data('lightGallery');
2640
+
2641
+ this.core.s = $.extend({}, defaults, this.core.s);
2642
+
2643
+ if (this.core.s.zoom && this.core.doCss()) {
2644
+ this.init();
2645
+
2646
+ // Store the zoomable timeout value just to clear it while closing
2647
+ this.zoomabletimeout = false;
2648
+
2649
+ // Set the initial value center
2650
+ this.pageX = $(window).width() / 2;
2651
+ this.pageY = ($(window).height() / 2) + $(window).scrollTop();
2652
+ }
2653
+
2654
+ return this;
2655
+ };
2656
+
2657
+ Zoom.prototype.init = function() {
2658
+
2659
+ var _this = this;
2660
+ var zoomIcons = '<span id="lg-zoom-in" class="lg-icon"></span><span id="lg-zoom-out" class="lg-icon"></span>';
2661
+
2662
+ if (_this.core.s.actualSize) {
2663
+ zoomIcons += '<span id="lg-actual-size" class="lg-icon"></span>';
2664
+ }
2665
+
2666
+ if (_this.core.s.useLeftForZoom) {
2667
+ _this.core.$outer.addClass('lg-use-left-for-zoom');
2668
+ } else {
2669
+ _this.core.$outer.addClass('lg-use-transition-for-zoom');
2670
+ }
2671
+
2672
+ this.core.$outer.find('.lg-toolbar').append(zoomIcons);
2673
+
2674
+ // Add zoomable class
2675
+ _this.core.$el.on('onSlideItemLoad.lg.tm.zoom', function(event, index, delay) {
2676
+
2677
+ // delay will be 0 except first time
2678
+ var _speed = _this.core.s.enableZoomAfter + delay;
2679
+
2680
+ // set _speed value 0 if gallery opened from direct url and if it is first slide
2681
+ if ($('body').hasClass('lg-from-hash') && delay) {
2682
+
2683
+ // will execute only once
2684
+ _speed = 0;
2685
+ } else {
2686
+
2687
+ // Remove lg-from-hash to enable starting animation.
2688
+ $('body').removeClass('lg-from-hash');
2689
+ }
2690
+
2691
+ _this.zoomabletimeout = setTimeout(function() {
2692
+ _this.core.$slide.eq(index).addClass('lg-zoomable');
2693
+ }, _speed + 30);
2694
+ });
2695
+
2696
+ var scale = 1;
2697
+ /**
2698
+ * @desc Image zoom
2699
+ * Translate the wrap and scale the image to get better user experience
2700
+ *
2701
+ * @param {String} scaleVal - Zoom decrement/increment value
2702
+ */
2703
+ var zoom = function(scaleVal) {
2704
+
2705
+ var $image = _this.core.$outer.find('.lg-current .lg-image');
2706
+ var _x;
2707
+ var _y;
2708
+
2709
+ // Find offset manually to avoid issue after zoom
2710
+ var offsetX = ($(window).width() - $image.prop('offsetWidth')) / 2;
2711
+ var offsetY = (($(window).height() - $image.prop('offsetHeight')) / 2) + $(window).scrollTop();
2712
+
2713
+ _x = _this.pageX - offsetX;
2714
+ _y = _this.pageY - offsetY;
2715
+
2716
+ var x = (scaleVal - 1) * (_x);
2717
+ var y = (scaleVal - 1) * (_y);
2718
+
2719
+ $image.css('transform', 'scale3d(' + scaleVal + ', ' + scaleVal + ', 1)').attr('data-scale', scaleVal);
2720
+
2721
+ if (_this.core.s.useLeftForZoom) {
2722
+ $image.parent().css({
2723
+ left: -x + 'px',
2724
+ top: -y + 'px'
2725
+ }).attr('data-x', x).attr('data-y', y);
2726
+ } else {
2727
+ $image.parent().css('transform', 'translate3d(-' + x + 'px, -' + y + 'px, 0)').attr('data-x', x).attr('data-y', y);
2728
+ }
2729
+ };
2730
+
2731
+ var callScale = function() {
2732
+ if (scale > 1) {
2733
+ _this.core.$outer.addClass('lg-zoomed');
2734
+ } else {
2735
+ _this.resetZoom();
2736
+ }
2737
+
2738
+ if (scale < 1) {
2739
+ scale = 1;
2740
+ }
2741
+
2742
+ zoom(scale);
2743
+ };
2744
+
2745
+ var actualSize = function(event, $image, index, fromIcon) {
2746
+ var w = $image.prop('offsetWidth');
2747
+ var nw;
2748
+ if (_this.core.s.dynamic) {
2749
+ nw = _this.core.s.dynamicEl[index].width || $image[0].naturalWidth || w;
2750
+ } else {
2751
+ nw = _this.core.$items.eq(index).attr('data-width') || $image[0].naturalWidth || w;
2752
+ }
2753
+
2754
+ var _scale;
2755
+
2756
+ if (_this.core.$outer.hasClass('lg-zoomed')) {
2757
+ scale = 1;
2758
+ } else {
2759
+ if (nw > w) {
2760
+ _scale = nw / w;
2761
+ scale = _scale || 2;
2762
+ }
2763
+ }
2764
+
2765
+ if (fromIcon) {
2766
+ _this.pageX = $(window).width() / 2;
2767
+ _this.pageY = ($(window).height() / 2) + $(window).scrollTop();
2768
+ } else {
2769
+ _this.pageX = event.pageX || event.originalEvent.targetTouches[0].pageX;
2770
+ _this.pageY = event.pageY || event.originalEvent.targetTouches[0].pageY;
2771
+ }
2772
+
2773
+ callScale();
2774
+ setTimeout(function() {
2775
+ _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab');
2776
+ }, 10);
2777
+ };
2778
+
2779
+ var tapped = false;
2780
+
2781
+ // event triggered after appending slide content
2782
+ _this.core.$el.on('onAferAppendSlide.lg.tm.zoom', function(event, index) {
2783
+
2784
+ // Get the current element
2785
+ var $image = _this.core.$slide.eq(index).find('.lg-image');
2786
+
2787
+ $image.on('dblclick', function(event) {
2788
+ actualSize(event, $image, index);
2789
+ });
2790
+
2791
+ $image.on('touchstart', function(event) {
2792
+ if (!tapped) {
2793
+ tapped = setTimeout(function() {
2794
+ tapped = null;
2795
+ }, 300);
2796
+ } else {
2797
+ clearTimeout(tapped);
2798
+ tapped = null;
2799
+ actualSize(event, $image, index);
2800
+ }
2801
+
2802
+ event.preventDefault();
2803
+ });
2804
+
2805
+ });
2806
+
2807
+ // Update zoom on resize and orientationchange
2808
+ $(window).on('resize.lg.zoom scroll.lg.zoom orientationchange.lg.zoom', function() {
2809
+ _this.pageX = $(window).width() / 2;
2810
+ _this.pageY = ($(window).height() / 2) + $(window).scrollTop();
2811
+ zoom(scale);
2812
+ });
2813
+
2814
+ $('#lg-zoom-out').on('click.lg', function() {
2815
+ if (_this.core.$outer.find('.lg-current .lg-image').length) {
2816
+ scale -= _this.core.s.scale;
2817
+ callScale();
2818
+ }
2819
+ });
2820
+
2821
+ $('#lg-zoom-in').on('click.lg', function() {
2822
+ if (_this.core.$outer.find('.lg-current .lg-image').length) {
2823
+ scale += _this.core.s.scale;
2824
+ callScale();
2825
+ }
2826
+ });
2827
+
2828
+ $('#lg-actual-size').on('click.lg', function(event) {
2829
+ actualSize(event, _this.core.$slide.eq(_this.core.index).find('.lg-image'), _this.core.index, true);
2830
+ });
2831
+
2832
+ // Reset zoom on slide change
2833
+ _this.core.$el.on('onBeforeSlide.lg.tm', function() {
2834
+ scale = 1;
2835
+ _this.resetZoom();
2836
+ });
2837
+
2838
+ // Drag option after zoom
2839
+ _this.zoomDrag();
2840
+
2841
+ _this.zoomSwipe();
2842
+
2843
+ };
2844
+
2845
+ // Reset zoom effect
2846
+ Zoom.prototype.resetZoom = function() {
2847
+ this.core.$outer.removeClass('lg-zoomed');
2848
+ this.core.$slide.find('.lg-img-wrap').removeAttr('style data-x data-y');
2849
+ this.core.$slide.find('.lg-image').removeAttr('style data-scale');
2850
+
2851
+ // Reset pagx pagy values to center
2852
+ this.pageX = $(window).width() / 2;
2853
+ this.pageY = ($(window).height() / 2) + $(window).scrollTop();
2854
+ };
2855
+
2856
+ Zoom.prototype.zoomSwipe = function() {
2857
+ var _this = this;
2858
+ var startCoords = {};
2859
+ var endCoords = {};
2860
+ var isMoved = false;
2861
+
2862
+ // Allow x direction drag
2863
+ var allowX = false;
2864
+
2865
+ // Allow Y direction drag
2866
+ var allowY = false;
2867
+
2868
+ _this.core.$slide.on('touchstart.lg', function(e) {
2869
+
2870
+ if (_this.core.$outer.hasClass('lg-zoomed')) {
2871
+ var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
2872
+
2873
+ allowY = $image.prop('offsetHeight') * $image.attr('data-scale') > _this.core.$outer.find('.lg').height();
2874
+ allowX = $image.prop('offsetWidth') * $image.attr('data-scale') > _this.core.$outer.find('.lg').width();
2875
+ if ((allowX || allowY)) {
2876
+ e.preventDefault();
2877
+ startCoords = {
2878
+ x: e.originalEvent.targetTouches[0].pageX,
2879
+ y: e.originalEvent.targetTouches[0].pageY
2880
+ };
2881
+ }
2882
+ }
2883
+
2884
+ });
2885
+
2886
+ _this.core.$slide.on('touchmove.lg', function(e) {
2887
+
2888
+ if (_this.core.$outer.hasClass('lg-zoomed')) {
2889
+
2890
+ var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
2891
+ var distanceX;
2892
+ var distanceY;
2893
+
2894
+ e.preventDefault();
2895
+ isMoved = true;
2896
+
2897
+ endCoords = {
2898
+ x: e.originalEvent.targetTouches[0].pageX,
2899
+ y: e.originalEvent.targetTouches[0].pageY
2900
+ };
2901
+
2902
+ // reset opacity and transition duration
2903
+ _this.core.$outer.addClass('lg-zoom-dragging');
2904
+
2905
+ if (allowY) {
2906
+ distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
2907
+ } else {
2908
+ distanceY = -Math.abs(_$el.attr('data-y'));
2909
+ }
2910
+
2911
+ if (allowX) {
2912
+ distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
2913
+ } else {
2914
+ distanceX = -Math.abs(_$el.attr('data-x'));
2915
+ }
2916
+
2917
+ if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
2918
+
2919
+ if (_this.core.s.useLeftForZoom) {
2920
+ _$el.css({
2921
+ left: distanceX + 'px',
2922
+ top: distanceY + 'px'
2923
+ });
2924
+ } else {
2925
+ _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)');
2926
+ }
2927
+ }
2928
+
2929
+ }
2930
+
2931
+ });
2932
+
2933
+ _this.core.$slide.on('touchend.lg', function() {
2934
+ if (_this.core.$outer.hasClass('lg-zoomed')) {
2935
+ if (isMoved) {
2936
+ isMoved = false;
2937
+ _this.core.$outer.removeClass('lg-zoom-dragging');
2938
+ _this.touchendZoom(startCoords, endCoords, allowX, allowY);
2939
+
2940
+ }
2941
+ }
2942
+ });
2943
+
2944
+ };
2945
+
2946
+ Zoom.prototype.zoomDrag = function() {
2947
+
2948
+ var _this = this;
2949
+ var startCoords = {};
2950
+ var endCoords = {};
2951
+ var isDraging = false;
2952
+ var isMoved = false;
2953
+
2954
+ // Allow x direction drag
2955
+ var allowX = false;
2956
+
2957
+ // Allow Y direction drag
2958
+ var allowY = false;
2959
+
2960
+ _this.core.$slide.on('mousedown.lg.zoom', function(e) {
2961
+
2962
+ // execute only on .lg-object
2963
+ var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
2964
+
2965
+ allowY = $image.prop('offsetHeight') * $image.attr('data-scale') > _this.core.$outer.find('.lg').height();
2966
+ allowX = $image.prop('offsetWidth') * $image.attr('data-scale') > _this.core.$outer.find('.lg').width();
2967
+
2968
+ if (_this.core.$outer.hasClass('lg-zoomed')) {
2969
+ if ($(e.target).hasClass('lg-object') && (allowX || allowY)) {
2970
+ e.preventDefault();
2971
+ startCoords = {
2972
+ x: e.pageX,
2973
+ y: e.pageY
2974
+ };
2975
+
2976
+ isDraging = true;
2977
+
2978
+ // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
2979
+ _this.core.$outer.scrollLeft += 1;
2980
+ _this.core.$outer.scrollLeft -= 1;
2981
+
2982
+ _this.core.$outer.removeClass('lg-grab').addClass('lg-grabbing');
2983
+ }
2984
+ }
2985
+ });
2986
+
2987
+ $(window).on('mousemove.lg.zoom', function(e) {
2988
+ if (isDraging) {
2989
+ var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
2990
+ var distanceX;
2991
+ var distanceY;
2992
+
2993
+ isMoved = true;
2994
+ endCoords = {
2995
+ x: e.pageX,
2996
+ y: e.pageY
2997
+ };
2998
+
2999
+ // reset opacity and transition duration
3000
+ _this.core.$outer.addClass('lg-zoom-dragging');
3001
+
3002
+ if (allowY) {
3003
+ distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
3004
+ } else {
3005
+ distanceY = -Math.abs(_$el.attr('data-y'));
3006
+ }
3007
+
3008
+ if (allowX) {
3009
+ distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
3010
+ } else {
3011
+ distanceX = -Math.abs(_$el.attr('data-x'));
3012
+ }
3013
+
3014
+ if (_this.core.s.useLeftForZoom) {
3015
+ _$el.css({
3016
+ left: distanceX + 'px',
3017
+ top: distanceY + 'px'
3018
+ });
3019
+ } else {
3020
+ _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)');
3021
+ }
3022
+ }
3023
+ });
3024
+
3025
+ $(window).on('mouseup.lg.zoom', function(e) {
3026
+
3027
+ if (isDraging) {
3028
+ isDraging = false;
3029
+ _this.core.$outer.removeClass('lg-zoom-dragging');
3030
+
3031
+ // Fix for chrome mouse move on click
3032
+ if (isMoved && ((startCoords.x !== endCoords.x) || (startCoords.y !== endCoords.y))) {
3033
+ endCoords = {
3034
+ x: e.pageX,
3035
+ y: e.pageY
3036
+ };
3037
+ _this.touchendZoom(startCoords, endCoords, allowX, allowY);
3038
+
3039
+ }
3040
+
3041
+ isMoved = false;
3042
+ }
3043
+
3044
+ _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab');
3045
+
3046
+ });
3047
+ };
3048
+
3049
+ Zoom.prototype.touchendZoom = function(startCoords, endCoords, allowX, allowY) {
3050
+
3051
+ var _this = this;
3052
+ var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
3053
+ var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
3054
+ var distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
3055
+ var distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
3056
+ var minY = (_this.core.$outer.find('.lg').height() - $image.prop('offsetHeight')) / 2;
3057
+ var maxY = Math.abs(($image.prop('offsetHeight') * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').height() + minY);
3058
+ var minX = (_this.core.$outer.find('.lg').width() - $image.prop('offsetWidth')) / 2;
3059
+ var maxX = Math.abs(($image.prop('offsetWidth') * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').width() + minX);
3060
+
3061
+ if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
3062
+ if (allowY) {
3063
+ if (distanceY <= -maxY) {
3064
+ distanceY = -maxY;
3065
+ } else if (distanceY >= -minY) {
3066
+ distanceY = -minY;
3067
+ }
3068
+ }
3069
+
3070
+ if (allowX) {
3071
+ if (distanceX <= -maxX) {
3072
+ distanceX = -maxX;
3073
+ } else if (distanceX >= -minX) {
3074
+ distanceX = -minX;
3075
+ }
3076
+ }
3077
+
3078
+ if (allowY) {
3079
+ _$el.attr('data-y', Math.abs(distanceY));
3080
+ } else {
3081
+ distanceY = -Math.abs(_$el.attr('data-y'));
3082
+ }
3083
+
3084
+ if (allowX) {
3085
+ _$el.attr('data-x', Math.abs(distanceX));
3086
+ } else {
3087
+ distanceX = -Math.abs(_$el.attr('data-x'));
3088
+ }
3089
+
3090
+ if (_this.core.s.useLeftForZoom) {
3091
+ _$el.css({
3092
+ left: distanceX + 'px',
3093
+ top: distanceY + 'px'
3094
+ });
3095
+ } else {
3096
+ _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)');
3097
+ }
3098
+
3099
+ }
3100
+ };
3101
+
3102
+ Zoom.prototype.destroy = function() {
3103
+
3104
+ var _this = this;
3105
+
3106
+ // Unbind all events added by lightGallery zoom plugin
3107
+ _this.core.$el.off('.lg.zoom');
3108
+ $(window).off('.lg.zoom');
3109
+ _this.core.$slide.off('.lg.zoom');
3110
+ _this.core.$el.off('.lg.tm.zoom');
3111
+ _this.resetZoom();
3112
+ clearTimeout(_this.zoomabletimeout);
3113
+ _this.zoomabletimeout = false;
3114
+ };
3115
+
3116
+ $.fn.lightGallery.modules.zoom = Zoom;
3117
+
3118
+ })();
3119
+
3120
+
3121
+ }));
3122
+
3123
+ /*! lg-hash - v1.0.2 - 2017-06-03
3124
+ * http://sachinchoolur.github.io/lightGallery
3125
+ * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
3126
+
3127
+ (function (root, factory) {
3128
+ if (typeof define === 'function' && define.amd) {
3129
+ // AMD. Register as an anonymous module unless amdModuleId is set
3130
+ define(['jquery'], function (a0) {
3131
+ return (factory(a0));
3132
+ });
3133
+ } else if (typeof exports === 'object') {
3134
+ // Node. Does not work with strict CommonJS, but
3135
+ // only CommonJS-like environments that support module.exports,
3136
+ // like Node.
3137
+ module.exports = factory(require('jquery'));
3138
+ } else {
3139
+ factory(jQuery);
3140
+ }
3141
+ }(this, function ($) {
3142
+
3143
+ (function() {
3144
+
3145
+ 'use strict';
3146
+
3147
+ var defaults = {
3148
+ hash: true
3149
+ };
3150
+
3151
+ var Hash = function(element) {
3152
+
3153
+ this.core = $(element).data('lightGallery');
3154
+
3155
+ this.core.s = $.extend({}, defaults, this.core.s);
3156
+
3157
+ if (this.core.s.hash) {
3158
+ this.oldHash = window.location.hash;
3159
+ this.init();
3160
+ }
3161
+
3162
+ return this;
3163
+ };
3164
+
3165
+ Hash.prototype.init = function() {
3166
+ var _this = this;
3167
+ var _hash;
3168
+
3169
+ // Change hash value on after each slide transition
3170
+ _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex, index) {
3171
+ if (history.replaceState) {
3172
+ history.replaceState(null, null, '#lg=' + _this.core.s.galleryId + '&slide=' + index);
3173
+ } else {
3174
+ window.location.hash = 'lg=' + _this.core.s.galleryId + '&slide=' + index;
3175
+ }
3176
+ });
3177
+
3178
+ // Listen hash change and change the slide according to slide value
3179
+ $(window).on('hashchange.lg.hash', function() {
3180
+ _hash = window.location.hash;
3181
+ var _idx = parseInt(_hash.split('&slide=')[1], 10);
3182
+
3183
+ // it galleryId doesn't exist in the url close the gallery
3184
+ if ((_hash.indexOf('lg=' + _this.core.s.galleryId) > -1)) {
3185
+ _this.core.slide(_idx, false, false);
3186
+ } else if (_this.core.lGalleryOn) {
3187
+ _this.core.destroy();
3188
+ }
3189
+
3190
+ });
3191
+ };
3192
+
3193
+ Hash.prototype.destroy = function() {
3194
+
3195
+ if (!this.core.s.hash) {
3196
+ return;
3197
+ }
3198
+
3199
+ // Reset to old hash value
3200
+ if (this.oldHash && this.oldHash.indexOf('lg=' + this.core.s.galleryId) < 0) {
3201
+ if (history.replaceState) {
3202
+ history.replaceState(null, null, this.oldHash);
3203
+ } else {
3204
+ window.location.hash = this.oldHash;
3205
+ }
3206
+ } else {
3207
+ if (history.replaceState) {
3208
+ history.replaceState(null, document.title, window.location.pathname + window.location.search);
3209
+ } else {
3210
+ window.location.hash = '';
3211
+ }
3212
+ }
3213
+
3214
+ this.core.$el.off('.lg.hash');
3215
+
3216
+ };
3217
+
3218
+ $.fn.lightGallery.modules.hash = Hash;
3219
+
3220
+ })();
3221
+
3222
+ }));
3223
+
3224
+ /*! lg-share - v1.0.2 - 2016-11-26
3225
+ * http://sachinchoolur.github.io/lightGallery
3226
+ * Copyright (c) 2016 Sachin N; Licensed GPLv3 */
3227
+
3228
+ (function (root, factory) {
3229
+ if (typeof define === 'function' && define.amd) {
3230
+ // AMD. Register as an anonymous module unless amdModuleId is set
3231
+ define(['jquery'], function (a0) {
3232
+ return (factory(a0));
3233
+ });
3234
+ } else if (typeof exports === 'object') {
3235
+ // Node. Does not work with strict CommonJS, but
3236
+ // only CommonJS-like environments that support module.exports,
3237
+ // like Node.
3238
+ module.exports = factory(require('jquery'));
3239
+ } else {
3240
+ factory(jQuery);
3241
+ }
3242
+ }(this, function ($) {
3243
+
3244
+ (function() {
3245
+
3246
+ 'use strict';
3247
+
3248
+ var defaults = {
3249
+ share: true,
3250
+ facebook: true,
3251
+ facebookDropdownText: 'Facebook',
3252
+ twitter: true,
3253
+ twitterDropdownText: 'Twitter',
3254
+ googlePlus: true,
3255
+ googlePlusDropdownText: 'GooglePlus',
3256
+ pinterest: true,
3257
+ pinterestDropdownText: 'Pinterest'
3258
+ };
3259
+
3260
+ var Share = function(element) {
3261
+
3262
+ this.core = $(element).data('lightGallery');
3263
+
3264
+ this.core.s = $.extend({}, defaults, this.core.s);
3265
+ if (this.core.s.share) {
3266
+ this.init();
3267
+ }
3268
+
3269
+ return this;
3270
+ };
3271
+
3272
+ Share.prototype.init = function() {
3273
+ var _this = this;
3274
+ var shareHtml = '<span id="lg-share" class="lg-icon">' +
3275
+ '<ul class="lg-dropdown" style="position: absolute;">';
3276
+ shareHtml += _this.core.s.facebook ? '<li><a id="lg-share-facebook" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + this.core.s.facebookDropdownText + '</span></a></li>' : '';
3277
+ shareHtml += _this.core.s.twitter ? '<li><a id="lg-share-twitter" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + this.core.s.twitterDropdownText + '</span></a></li>' : '';
3278
+ shareHtml += _this.core.s.googlePlus ? '<li><a id="lg-share-googleplus" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + this.core.s.googlePlusDropdownText + '</span></a></li>' : '';
3279
+ shareHtml += _this.core.s.pinterest ? '<li><a id="lg-share-pinterest" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + this.core.s.pinterestDropdownText + '</span></a></li>' : '';
3280
+ shareHtml += '</ul></span>';
3281
+
3282
+ this.core.$outer.find('.lg-toolbar').append(shareHtml);
3283
+ this.core.$outer.find('.lg').append('<div id="lg-dropdown-overlay"></div>');
3284
+ $('#lg-share').on('click.lg', function(){
3285
+ _this.core.$outer.toggleClass('lg-dropdown-active');
3286
+ });
3287
+
3288
+ $('#lg-dropdown-overlay').on('click.lg', function(){
3289
+ _this.core.$outer.removeClass('lg-dropdown-active');
3290
+ });
3291
+
3292
+ _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex, index) {
3293
+
3294
+ setTimeout(function() {
3295
+ $('#lg-share-facebook').attr('href', 'https://www.facebook.com/sharer/sharer.php?u=' + (encodeURIComponent(_this.core.$items.eq(index).attr('data-facebook-share-url') || window.location.href)));
3296
+
3297
+ $('#lg-share-twitter').attr('href', 'https://twitter.com/intent/tweet?text=' + _this.core.$items.eq(index).attr('data-tweet-text') + '&url=' + (encodeURIComponent(_this.core.$items.eq(index).attr('data-twitter-share-url') || window.location.href)));
3298
+
3299
+ $('#lg-share-googleplus').attr('href', 'https://plus.google.com/share?url=' + (encodeURIComponent(_this.core.$items.eq(index).attr('data-googleplus-share-url') || window.location.href)));
3300
+
3301
+ $('#lg-share-pinterest').attr('href', 'http://www.pinterest.com/pin/create/button/?url=' + (encodeURIComponent(_this.core.$items.eq(index).attr('data-pinterest-share-url') || window.location.href)) + '&media=' + encodeURIComponent(_this.core.$items.eq(index).attr('href') || _this.core.$items.eq(index).attr('data-src')) + '&description=' + _this.core.$items.eq(index).attr('data-pinterest-text'));
3302
+
3303
+ }, 100);
3304
+ });
3305
+ };
3306
+
3307
+ Share.prototype.destroy = function() {
3308
+
3309
+ };
3310
+
3311
+ $.fn.lightGallery.modules.share = Share;
3312
+
3313
+ })();
3314
+
3315
+
3316
+
3317
+ }));