lightgallery-rails 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +1 -0
- data/lib/lightgallery/rails.rb +7 -0
- data/lib/lightgallery/rails/engine.rb +6 -0
- data/lib/lightgallery/rails/version.rb +5 -0
- data/vendor/assets/fonts/lightgallery/lg.eot +0 -0
- data/vendor/assets/fonts/lightgallery/lg.svg +47 -0
- data/vendor/assets/fonts/lightgallery/lg.ttf +0 -0
- data/vendor/assets/fonts/lightgallery/lg.woff +0 -0
- data/vendor/assets/images/lightgallery/loading.gif +0 -0
- data/vendor/assets/images/lightgallery/video-play.png +0 -0
- data/vendor/assets/images/lightgallery/vimeo-play.png +0 -0
- data/vendor/assets/images/lightgallery/youtube-play.png +0 -0
- data/vendor/assets/javascripts/lightgallery.autoplay.js +206 -0
- data/vendor/assets/javascripts/lightgallery.autoplay.min.js +4 -0
- data/vendor/assets/javascripts/lightgallery.fullscreen.js +116 -0
- data/vendor/assets/javascripts/lightgallery.fullscreen.min.js +4 -0
- data/vendor/assets/javascripts/lightgallery.hash.js +100 -0
- data/vendor/assets/javascripts/lightgallery.hash.min.js +4 -0
- data/vendor/assets/javascripts/lightgallery.js +1364 -0
- data/vendor/assets/javascripts/lightgallery.min.js +4 -0
- data/vendor/assets/javascripts/lightgallery.pager.js +105 -0
- data/vendor/assets/javascripts/lightgallery.pager.min.js +4 -0
- data/vendor/assets/javascripts/lightgallery.share.js +94 -0
- data/vendor/assets/javascripts/lightgallery.share.min.js +4 -0
- data/vendor/assets/javascripts/lightgallery.thumbnail.js +473 -0
- data/vendor/assets/javascripts/lightgallery.thumbnail.min.js +4 -0
- data/vendor/assets/javascripts/lightgallery.video.js +317 -0
- data/vendor/assets/javascripts/lightgallery.video.min.js +4 -0
- data/vendor/assets/javascripts/lightgallery.zoom.js +531 -0
- data/vendor/assets/javascripts/lightgallery.zoom.min.js +4 -0
- data/vendor/assets/stylesheets/lg-fb-comment-box.scss +57 -0
- data/vendor/assets/stylesheets/lg-transitions.css +779 -0
- data/vendor/assets/stylesheets/lightgallery.scss +978 -0
- metadata +104 -0
@@ -0,0 +1,4 @@
|
|
1
|
+
/*! lightgallery - v1.4.0 - 2017-06-04
|
2
|
+
* http://sachinchoolur.github.io/lightGallery/
|
3
|
+
* Copyright (c) 2017 Sachin N; Licensed GPLv3 */
|
4
|
+
!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(){"use strict";function b(b,d){if(this.el=b,this.$el=a(b),this.s=a.extend({},c,d),this.s.dynamic&&"undefined"!==this.s.dynamicEl&&this.s.dynamicEl.constructor===Array&&!this.s.dynamicEl.length)throw"When using dynamic mode, you must also define dynamicEl as an Array.";return this.modules={},this.lGalleryOn=!1,this.lgBusy=!1,this.hideBartimeout=!1,this.isTouch="ontouchstart"in document.documentElement,this.s.slideEndAnimatoin&&(this.s.hideControlOnEnd=!1),this.s.dynamic?this.$items=this.s.dynamicEl:"this"===this.s.selector?this.$items=this.$el:""!==this.s.selector?this.s.selectWithin?this.$items=a(this.s.selectWithin).find(this.s.selector):this.$items=this.$el.find(a(this.s.selector)):this.$items=this.$el.children(),this.$slide="",this.$outer="",this.init(),this}var c={mode:"lg-slide",cssEasing:"ease",easing:"linear",speed:600,height:"100%",width:"100%",addClass:"",startClass:"lg-start-zoom",backdropDuration:150,hideBarsDelay:6e3,useLeft:!1,closable:!0,loop:!0,escKey:!0,keyPress:!0,controls:!0,slideEndAnimatoin:!0,hideControlOnEnd:!1,mousewheel:!0,getCaptionFromTitleOrAlt:!0,appendSubHtmlTo:".lg-sub-html",subHtmlSelectorRelative:!1,preload:1,showAfterLoad:!0,selector:"",selectWithin:"",nextHtml:"",prevHtml:"",index:!1,iframeMaxWidth:"100%",download:!0,counter:!0,appendCounterTo:".lg-toolbar",swipeThreshold:50,enableSwipe:!0,enableDrag:!0,dynamic:!1,dynamicEl:[],galleryId:1};b.prototype.init=function(){var b=this;b.s.preload>b.$items.length&&(b.s.preload=b.$items.length);var c=window.location.hash;c.indexOf("lg="+this.s.galleryId)>0&&(b.index=parseInt(c.split("&slide=")[1],10),a("body").addClass("lg-from-hash"),a("body").hasClass("lg-on")||(setTimeout(function(){b.build(b.index)}),a("body").addClass("lg-on"))),b.s.dynamic?(b.$el.trigger("onBeforeOpen.lg"),b.index=b.s.index||0,a("body").hasClass("lg-on")||setTimeout(function(){b.build(b.index),a("body").addClass("lg-on")})):b.$items.on("click.lgcustom",function(c){try{c.preventDefault(),c.preventDefault()}catch(a){c.returnValue=!1}b.$el.trigger("onBeforeOpen.lg"),b.index=b.s.index||b.$items.index(this),a("body").hasClass("lg-on")||(b.build(b.index),a("body").addClass("lg-on"))})},b.prototype.build=function(b){var c=this;c.structure(),a.each(a.fn.lightGallery.modules,function(b){c.modules[b]=new a.fn.lightGallery.modules[b](c.el)}),c.slide(b,!1,!1,!1),c.s.keyPress&&c.keyPress(),c.$items.length>1?(c.arrow(),setTimeout(function(){c.enableDrag(),c.enableSwipe()},50),c.s.mousewheel&&c.mousewheel()):c.$slide.on("click.lg",function(){c.$el.trigger("onSlideClick.lg")}),c.counter(),c.closeGallery(),c.$el.trigger("onAfterOpen.lg"),c.$outer.on("mousemove.lg click.lg touchstart.lg",function(){c.$outer.removeClass("lg-hide-items"),clearTimeout(c.hideBartimeout),c.hideBartimeout=setTimeout(function(){c.$outer.addClass("lg-hide-items")},c.s.hideBarsDelay)}),c.$outer.trigger("mousemove.lg")},b.prototype.structure=function(){var b,c="",d="",e=0,f="",g=this;for(a("body").append('<div class="lg-backdrop"></div>'),a(".lg-backdrop").css("transition-duration",this.s.backdropDuration+"ms"),e=0;e<this.$items.length;e++)c+='<div class="lg-item"></div>';if(this.s.controls&&this.$items.length>1&&(d='<div class="lg-actions"><button class="lg-prev lg-icon">'+this.s.prevHtml+'</button><button class="lg-next lg-icon">'+this.s.nextHtml+"</button></div>"),".lg-sub-html"===this.s.appendSubHtmlTo&&(f='<div class="lg-sub-html"></div>'),b='<div class="lg-outer '+this.s.addClass+" "+this.s.startClass+'"><div class="lg" style="width:'+this.s.width+"; height:"+this.s.height+'"><div class="lg-inner">'+c+'</div><div class="lg-toolbar lg-group"><span class="lg-close lg-icon"></span></div>'+d+f+"</div></div>",a("body").append(b),this.$outer=a(".lg-outer"),this.$slide=this.$outer.find(".lg-item"),this.s.useLeft?(this.$outer.addClass("lg-use-left"),this.s.mode="lg-slide"):this.$outer.addClass("lg-use-css3"),g.setTop(),a(window).on("resize.lg orientationchange.lg",function(){setTimeout(function(){g.setTop()},100)}),this.$slide.eq(this.index).addClass("lg-current"),this.doCss()?this.$outer.addClass("lg-css3"):(this.$outer.addClass("lg-css"),this.s.speed=0),this.$outer.addClass(this.s.mode),this.s.enableDrag&&this.$items.length>1&&this.$outer.addClass("lg-grab"),this.s.showAfterLoad&&this.$outer.addClass("lg-show-after-load"),this.doCss()){var h=this.$outer.find(".lg-inner");h.css("transition-timing-function",this.s.cssEasing),h.css("transition-duration",this.s.speed+"ms")}setTimeout(function(){a(".lg-backdrop").addClass("in")}),setTimeout(function(){g.$outer.addClass("lg-visible")},this.s.backdropDuration),this.s.download&&this.$outer.find(".lg-toolbar").append('<a id="lg-download" target="_blank" download class="lg-download lg-icon"></a>'),this.prevScrollTop=a(window).scrollTop()},b.prototype.setTop=function(){if("100%"!==this.s.height){var b=a(window).height(),c=(b-parseInt(this.s.height,10))/2,d=this.$outer.find(".lg");b>=parseInt(this.s.height,10)?d.css("top",c+"px"):d.css("top","0px")}},b.prototype.doCss=function(){var a=function(){var a=["transition","MozTransition","WebkitTransition","OTransition","msTransition","KhtmlTransition"],b=document.documentElement,c=0;for(c=0;c<a.length;c++)if(a[c]in b.style)return!0};return!!a()},b.prototype.isVideo=function(a,b){var c;if(c=this.s.dynamic?this.s.dynamicEl[b].html:this.$items.eq(b).attr("data-html"),!a)return c?{html5:!0}:(console.error("lightGallery :- data-src is not pvovided on slide item "+(b+1)+". Please make sure the selector property is properly configured. More info - http://sachinchoolur.github.io/lightGallery/demos/html-markup.html"),!1);var d=a.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i),e=a.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i),f=a.match(/\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i),g=a.match(/\/\/(?:www\.)?(?:vk\.com|vkontakte\.ru)\/(?:video_ext\.php\?)(.*)/i);return d?{youtube:d}:e?{vimeo:e}:f?{dailymotion:f}:g?{vk:g}:void 0},b.prototype.counter=function(){this.s.counter&&a(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>")},b.prototype.addHtml=function(b){var c,d,e=null;if(this.s.dynamic?this.s.dynamicEl[b].subHtmlUrl?c=this.s.dynamicEl[b].subHtmlUrl:e=this.s.dynamicEl[b].subHtml:(d=this.$items.eq(b),d.attr("data-sub-html-url")?c=d.attr("data-sub-html-url"):(e=d.attr("data-sub-html"),this.s.getCaptionFromTitleOrAlt&&!e&&(e=d.attr("title")||d.find("img").first().attr("alt")))),!c)if("undefined"!=typeof e&&null!==e){var f=e.substring(0,1);"."!==f&&"#"!==f||(e=this.s.subHtmlSelectorRelative&&!this.s.dynamic?d.find(e).html():a(e).html())}else e="";".lg-sub-html"===this.s.appendSubHtmlTo?c?this.$outer.find(this.s.appendSubHtmlTo).load(c):this.$outer.find(this.s.appendSubHtmlTo).html(e):c?this.$slide.eq(b).load(c):this.$slide.eq(b).append(e),"undefined"!=typeof e&&null!==e&&(""===e?this.$outer.find(this.s.appendSubHtmlTo).addClass("lg-empty-html"):this.$outer.find(this.s.appendSubHtmlTo).removeClass("lg-empty-html")),this.$el.trigger("onAfterAppendSubHtml.lg",[b])},b.prototype.preload=function(a){var b=1,c=1;for(b=1;b<=this.s.preload&&!(b>=this.$items.length-a);b++)this.loadContent(a+b,!1,0);for(c=1;c<=this.s.preload&&!(a-c<0);c++)this.loadContent(a-c,!1,0)},b.prototype.loadContent=function(b,c,d){var e,f,g,h,i,j,k=this,l=!1,m=function(b){for(var c=[],d=[],e=0;e<b.length;e++){var g=b[e].split(" ");""===g[0]&&g.splice(0,1),d.push(g[0]),c.push(g[1])}for(var h=a(window).width(),i=0;i<c.length;i++)if(parseInt(c[i],10)>h){f=d[i];break}};if(k.s.dynamic){if(k.s.dynamicEl[b].poster&&(l=!0,g=k.s.dynamicEl[b].poster),j=k.s.dynamicEl[b].html,f=k.s.dynamicEl[b].src,k.s.dynamicEl[b].responsive){var n=k.s.dynamicEl[b].responsive.split(",");m(n)}h=k.s.dynamicEl[b].srcset,i=k.s.dynamicEl[b].sizes}else{if(k.$items.eq(b).attr("data-poster")&&(l=!0,g=k.$items.eq(b).attr("data-poster")),j=k.$items.eq(b).attr("data-html"),f=k.$items.eq(b).attr("href")||k.$items.eq(b).attr("data-src"),k.$items.eq(b).attr("data-responsive")){var o=k.$items.eq(b).attr("data-responsive").split(",");m(o)}h=k.$items.eq(b).attr("data-srcset"),i=k.$items.eq(b).attr("data-sizes")}var p=!1;k.s.dynamic?k.s.dynamicEl[b].iframe&&(p=!0):"true"===k.$items.eq(b).attr("data-iframe")&&(p=!0);var q=k.isVideo(f,b);if(!k.$slide.eq(b).hasClass("lg-loaded")){if(p)k.$slide.eq(b).prepend('<div class="lg-video-cont lg-has-iframe" style="max-width:'+k.s.iframeMaxWidth+'"><div class="lg-video"><iframe class="lg-object" frameborder="0" src="'+f+'" allowfullscreen="true"></iframe></div></div>');else if(l){var r="";r=q&&q.youtube?"lg-has-youtube":q&&q.vimeo?"lg-has-vimeo":"lg-has-html5",k.$slide.eq(b).prepend('<div class="lg-video-cont '+r+' "><div class="lg-video"><span class="lg-video-play"></span><img class="lg-object lg-has-poster" src="'+g+'" /></div></div>')}else q?(k.$slide.eq(b).prepend('<div class="lg-video-cont "><div class="lg-video"></div></div>'),k.$el.trigger("hasVideo.lg",[b,f,j])):k.$slide.eq(b).prepend('<div class="lg-img-wrap"><img class="lg-object lg-image" src="'+f+'" /></div>');if(k.$el.trigger("onAferAppendSlide.lg",[b]),e=k.$slide.eq(b).find(".lg-object"),i&&e.attr("sizes",i),h){e.attr("srcset",h);try{picturefill({elements:[e[0]]})}catch(a){console.warn("lightGallery :- If you want srcset to be supported for older browser please include picturefil version 2 javascript library in your document.")}}".lg-sub-html"!==this.s.appendSubHtmlTo&&k.addHtml(b),k.$slide.eq(b).addClass("lg-loaded")}k.$slide.eq(b).find(".lg-object").on("load.lg error.lg",function(){var c=0;d&&!a("body").hasClass("lg-from-hash")&&(c=d),setTimeout(function(){k.$slide.eq(b).addClass("lg-complete"),k.$el.trigger("onSlideItemLoad.lg",[b,d||0])},c)}),q&&q.html5&&!l&&k.$slide.eq(b).addClass("lg-complete"),c===!0&&(k.$slide.eq(b).hasClass("lg-complete")?k.preload(b):k.$slide.eq(b).find(".lg-object").on("load.lg error.lg",function(){k.preload(b)}))},b.prototype.slide=function(b,c,d,e){var f=this.$outer.find(".lg-current").index(),g=this;if(!g.lGalleryOn||f!==b){var h=this.$slide.length,i=g.lGalleryOn?this.s.speed:0;if(!g.lgBusy){if(this.s.download){var j;j=g.s.dynamic?g.s.dynamicEl[b].downloadUrl!==!1&&(g.s.dynamicEl[b].downloadUrl||g.s.dynamicEl[b].src):"false"!==g.$items.eq(b).attr("data-download-url")&&(g.$items.eq(b).attr("data-download-url")||g.$items.eq(b).attr("href")||g.$items.eq(b).attr("data-src")),j?(a("#lg-download").attr("href",j),g.$outer.removeClass("lg-hide-download")):g.$outer.addClass("lg-hide-download")}if(this.$el.trigger("onBeforeSlide.lg",[f,b,c,d]),g.lgBusy=!0,clearTimeout(g.hideBartimeout),".lg-sub-html"===this.s.appendSubHtmlTo&&setTimeout(function(){g.addHtml(b)},i),this.arrowDisable(b),e||(b<f?e="prev":b>f&&(e="next")),c){this.$slide.removeClass("lg-prev-slide lg-current lg-next-slide");var k,l;h>2?(k=b-1,l=b+1,0===b&&f===h-1?(l=0,k=h-1):b===h-1&&0===f&&(l=0,k=h-1)):(k=0,l=1),"prev"===e?g.$slide.eq(l).addClass("lg-next-slide"):g.$slide.eq(k).addClass("lg-prev-slide"),g.$slide.eq(b).addClass("lg-current")}else g.$outer.addClass("lg-no-trans"),this.$slide.removeClass("lg-prev-slide lg-next-slide"),"prev"===e?(this.$slide.eq(b).addClass("lg-prev-slide"),this.$slide.eq(f).addClass("lg-next-slide")):(this.$slide.eq(b).addClass("lg-next-slide"),this.$slide.eq(f).addClass("lg-prev-slide")),setTimeout(function(){g.$slide.removeClass("lg-current"),g.$slide.eq(b).addClass("lg-current"),g.$outer.removeClass("lg-no-trans")},50);g.lGalleryOn?(setTimeout(function(){g.loadContent(b,!0,0)},this.s.speed+50),setTimeout(function(){g.lgBusy=!1,g.$el.trigger("onAfterSlide.lg",[f,b,c,d])},this.s.speed)):(g.loadContent(b,!0,g.s.backdropDuration),g.lgBusy=!1,g.$el.trigger("onAfterSlide.lg",[f,b,c,d])),g.lGalleryOn=!0,this.s.counter&&a("#lg-counter-current").text(b+1)}}},b.prototype.goToNextSlide=function(a){var b=this,c=b.s.loop;a&&b.$slide.length<3&&(c=!1),b.lgBusy||(b.index+1<b.$slide.length?(b.index++,b.$el.trigger("onBeforeNextSlide.lg",[b.index]),b.slide(b.index,a,!1,"next")):c?(b.index=0,b.$el.trigger("onBeforeNextSlide.lg",[b.index]),b.slide(b.index,a,!1,"next")):b.s.slideEndAnimatoin&&!a&&(b.$outer.addClass("lg-right-end"),setTimeout(function(){b.$outer.removeClass("lg-right-end")},400)))},b.prototype.goToPrevSlide=function(a){var b=this,c=b.s.loop;a&&b.$slide.length<3&&(c=!1),b.lgBusy||(b.index>0?(b.index--,b.$el.trigger("onBeforePrevSlide.lg",[b.index,a]),b.slide(b.index,a,!1,"prev")):c?(b.index=b.$items.length-1,b.$el.trigger("onBeforePrevSlide.lg",[b.index,a]),b.slide(b.index,a,!1,"prev")):b.s.slideEndAnimatoin&&!a&&(b.$outer.addClass("lg-left-end"),setTimeout(function(){b.$outer.removeClass("lg-left-end")},400)))},b.prototype.keyPress=function(){var b=this;this.$items.length>1&&a(window).on("keyup.lg",function(a){b.$items.length>1&&(37===a.keyCode&&(a.preventDefault(),b.goToPrevSlide()),39===a.keyCode&&(a.preventDefault(),b.goToNextSlide()))}),a(window).on("keydown.lg",function(a){b.s.escKey===!0&&27===a.keyCode&&(a.preventDefault(),b.$outer.hasClass("lg-thumb-open")?b.$outer.removeClass("lg-thumb-open"):b.destroy())})},b.prototype.arrow=function(){var a=this;this.$outer.find(".lg-prev").on("click.lg",function(){a.goToPrevSlide()}),this.$outer.find(".lg-next").on("click.lg",function(){a.goToNextSlide()})},b.prototype.arrowDisable=function(a){!this.s.loop&&this.s.hideControlOnEnd&&(a+1<this.$slide.length?this.$outer.find(".lg-next").removeAttr("disabled").removeClass("disabled"):this.$outer.find(".lg-next").attr("disabled","disabled").addClass("disabled"),a>0?this.$outer.find(".lg-prev").removeAttr("disabled").removeClass("disabled"):this.$outer.find(".lg-prev").attr("disabled","disabled").addClass("disabled"))},b.prototype.setTranslate=function(a,b,c){this.s.useLeft?a.css("left",b):a.css({transform:"translate3d("+b+"px, "+c+"px, 0px)"})},b.prototype.touchMove=function(b,c){var d=c-b;Math.abs(d)>15&&(this.$outer.addClass("lg-dragging"),this.setTranslate(this.$slide.eq(this.index),d,0),this.setTranslate(a(".lg-prev-slide"),-this.$slide.eq(this.index).width()+d,0),this.setTranslate(a(".lg-next-slide"),this.$slide.eq(this.index).width()+d,0))},b.prototype.touchEnd=function(a){var b=this;"lg-slide"!==b.s.mode&&b.$outer.addClass("lg-slide"),this.$slide.not(".lg-current, .lg-prev-slide, .lg-next-slide").css("opacity","0"),setTimeout(function(){b.$outer.removeClass("lg-dragging"),a<0&&Math.abs(a)>b.s.swipeThreshold?b.goToNextSlide(!0):a>0&&Math.abs(a)>b.s.swipeThreshold?b.goToPrevSlide(!0):Math.abs(a)<5&&b.$el.trigger("onSlideClick.lg"),b.$slide.removeAttr("style")}),setTimeout(function(){b.$outer.hasClass("lg-dragging")||"lg-slide"===b.s.mode||b.$outer.removeClass("lg-slide")},b.s.speed+100)},b.prototype.enableSwipe=function(){var a=this,b=0,c=0,d=!1;a.s.enableSwipe&&a.isTouch&&a.doCss()&&(a.$slide.on("touchstart.lg",function(c){a.$outer.hasClass("lg-zoomed")||a.lgBusy||(c.preventDefault(),a.manageSwipeClass(),b=c.originalEvent.targetTouches[0].pageX)}),a.$slide.on("touchmove.lg",function(e){a.$outer.hasClass("lg-zoomed")||(e.preventDefault(),c=e.originalEvent.targetTouches[0].pageX,a.touchMove(b,c),d=!0)}),a.$slide.on("touchend.lg",function(){a.$outer.hasClass("lg-zoomed")||(d?(d=!1,a.touchEnd(c-b)):a.$el.trigger("onSlideClick.lg"))}))},b.prototype.enableDrag=function(){var b=this,c=0,d=0,e=!1,f=!1;b.s.enableDrag&&!b.isTouch&&b.doCss()&&(b.$slide.on("mousedown.lg",function(d){b.$outer.hasClass("lg-zoomed")||(a(d.target).hasClass("lg-object")||a(d.target).hasClass("lg-video-play"))&&(d.preventDefault(),b.lgBusy||(b.manageSwipeClass(),c=d.pageX,e=!0,b.$outer.scrollLeft+=1,b.$outer.scrollLeft-=1,b.$outer.removeClass("lg-grab").addClass("lg-grabbing"),b.$el.trigger("onDragstart.lg")))}),a(window).on("mousemove.lg",function(a){e&&(f=!0,d=a.pageX,b.touchMove(c,d),b.$el.trigger("onDragmove.lg"))}),a(window).on("mouseup.lg",function(g){f?(f=!1,b.touchEnd(d-c),b.$el.trigger("onDragend.lg")):(a(g.target).hasClass("lg-object")||a(g.target).hasClass("lg-video-play"))&&b.$el.trigger("onSlideClick.lg"),e&&(e=!1,b.$outer.removeClass("lg-grabbing").addClass("lg-grab"))}))},b.prototype.manageSwipeClass=function(){var a=this.index+1,b=this.index-1;this.s.loop&&this.$slide.length>2&&(0===this.index?b=this.$slide.length-1:this.index===this.$slide.length-1&&(a=0)),this.$slide.removeClass("lg-next-slide lg-prev-slide"),b>-1&&this.$slide.eq(b).addClass("lg-prev-slide"),this.$slide.eq(a).addClass("lg-next-slide")},b.prototype.mousewheel=function(){var a=this;a.$outer.on("mousewheel.lg",function(b){b.deltaY&&(b.deltaY>0?a.goToPrevSlide():a.goToNextSlide(),b.preventDefault())})},b.prototype.closeGallery=function(){var b=this,c=!1;this.$outer.find(".lg-close").on("click.lg",function(){b.destroy()}),b.s.closable&&(b.$outer.on("mousedown.lg",function(b){c=!!(a(b.target).is(".lg-outer")||a(b.target).is(".lg-item ")||a(b.target).is(".lg-img-wrap"))}),b.$outer.on("mouseup.lg",function(d){(a(d.target).is(".lg-outer")||a(d.target).is(".lg-item ")||a(d.target).is(".lg-img-wrap")&&c)&&(b.$outer.hasClass("lg-dragging")||b.destroy())}))},b.prototype.destroy=function(b){var c=this;b||(c.$el.trigger("onBeforeClose.lg"),a(window).scrollTop(c.prevScrollTop)),b&&(c.s.dynamic||this.$items.off("click.lg click.lgcustom"),a.removeData(c.el,"lightGallery")),this.$el.off(".lg.tm"),a.each(a.fn.lightGallery.modules,function(a){c.modules[a]&&c.modules[a].destroy()}),this.lGalleryOn=!1,clearTimeout(c.hideBartimeout),this.hideBartimeout=!1,a(window).off(".lg"),a("body").removeClass("lg-on lg-from-hash"),c.$outer&&c.$outer.removeClass("lg-visible"),a(".lg-backdrop").removeClass("in"),setTimeout(function(){c.$outer&&c.$outer.remove(),a(".lg-backdrop").remove(),b||c.$el.trigger("onCloseAfter.lg")},c.s.backdropDuration+50)},a.fn.lightGallery=function(c){return this.each(function(){if(a.data(this,"lightGallery"))try{a(this).data("lightGallery").init()}catch(a){console.error("lightGallery has not initiated properly")}else a.data(this,"lightGallery",new b(this,c))})},a.fn.lightGallery.modules={}}()});
|
@@ -0,0 +1,105 @@
|
|
1
|
+
/*! lg-pager - v1.0.2 - 2017-01-22
|
2
|
+
* http://sachinchoolur.github.io/lightGallery
|
3
|
+
* Copyright (c) 2017 Sachin N; Licensed GPLv3 */
|
4
|
+
|
5
|
+
(function (root, factory) {
|
6
|
+
if (typeof define === 'function' && define.amd) {
|
7
|
+
// AMD. Register as an anonymous module unless amdModuleId is set
|
8
|
+
define(['jquery'], function (a0) {
|
9
|
+
return (factory(a0));
|
10
|
+
});
|
11
|
+
} else if (typeof exports === 'object') {
|
12
|
+
// Node. Does not work with strict CommonJS, but
|
13
|
+
// only CommonJS-like environments that support module.exports,
|
14
|
+
// like Node.
|
15
|
+
module.exports = factory(require('jquery'));
|
16
|
+
} else {
|
17
|
+
factory(jQuery);
|
18
|
+
}
|
19
|
+
}(this, function ($) {
|
20
|
+
|
21
|
+
(function() {
|
22
|
+
|
23
|
+
'use strict';
|
24
|
+
|
25
|
+
var defaults = {
|
26
|
+
pager: false
|
27
|
+
};
|
28
|
+
|
29
|
+
var Pager = function(element) {
|
30
|
+
|
31
|
+
this.core = $(element).data('lightGallery');
|
32
|
+
|
33
|
+
this.$el = $(element);
|
34
|
+
this.core.s = $.extend({}, defaults, this.core.s);
|
35
|
+
if (this.core.s.pager && this.core.$items.length > 1) {
|
36
|
+
this.init();
|
37
|
+
}
|
38
|
+
|
39
|
+
return this;
|
40
|
+
};
|
41
|
+
|
42
|
+
Pager.prototype.init = function() {
|
43
|
+
var _this = this;
|
44
|
+
var pagerList = '';
|
45
|
+
var $pagerCont;
|
46
|
+
var $pagerOuter;
|
47
|
+
var timeout;
|
48
|
+
|
49
|
+
_this.core.$outer.find('.lg').append('<div class="lg-pager-outer"></div>');
|
50
|
+
|
51
|
+
if (_this.core.s.dynamic) {
|
52
|
+
for (var i = 0; i < _this.core.s.dynamicEl.length; i++) {
|
53
|
+
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>';
|
54
|
+
}
|
55
|
+
} else {
|
56
|
+
_this.core.$items.each(function() {
|
57
|
+
|
58
|
+
if (!_this.core.s.exThumbImage) {
|
59
|
+
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>';
|
60
|
+
} else {
|
61
|
+
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>';
|
62
|
+
}
|
63
|
+
|
64
|
+
});
|
65
|
+
}
|
66
|
+
|
67
|
+
$pagerOuter = _this.core.$outer.find('.lg-pager-outer');
|
68
|
+
|
69
|
+
$pagerOuter.html(pagerList);
|
70
|
+
|
71
|
+
$pagerCont = _this.core.$outer.find('.lg-pager-cont');
|
72
|
+
$pagerCont.on('click.lg touchend.lg', function() {
|
73
|
+
var _$this = $(this);
|
74
|
+
_this.core.index = _$this.index();
|
75
|
+
_this.core.slide(_this.core.index, false, true, false);
|
76
|
+
});
|
77
|
+
|
78
|
+
$pagerOuter.on('mouseover.lg', function() {
|
79
|
+
clearTimeout(timeout);
|
80
|
+
$pagerOuter.addClass('lg-pager-hover');
|
81
|
+
});
|
82
|
+
|
83
|
+
$pagerOuter.on('mouseout.lg', function() {
|
84
|
+
timeout = setTimeout(function() {
|
85
|
+
$pagerOuter.removeClass('lg-pager-hover');
|
86
|
+
});
|
87
|
+
});
|
88
|
+
|
89
|
+
_this.core.$el.on('onBeforeSlide.lg.tm', function(e, prevIndex, index) {
|
90
|
+
$pagerCont.removeClass('lg-pager-active');
|
91
|
+
$pagerCont.eq(index).addClass('lg-pager-active');
|
92
|
+
});
|
93
|
+
|
94
|
+
};
|
95
|
+
|
96
|
+
Pager.prototype.destroy = function() {
|
97
|
+
|
98
|
+
};
|
99
|
+
|
100
|
+
$.fn.lightGallery.modules.pager = Pager;
|
101
|
+
|
102
|
+
})();
|
103
|
+
|
104
|
+
|
105
|
+
}));
|
@@ -0,0 +1,4 @@
|
|
1
|
+
/*! lg-pager - v1.0.2 - 2017-01-22
|
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={pager:!1},c=function(c){return this.core=a(c).data("lightGallery"),this.$el=a(c),this.core.s=a.extend({},b,this.core.s),this.core.s.pager&&this.core.$items.length>1&&this.init(),this};c.prototype.init=function(){var b,c,d,e=this,f="";if(e.core.$outer.find(".lg").append('<div class="lg-pager-outer"></div>'),e.core.s.dynamic)for(var g=0;g<e.core.s.dynamicEl.length;g++)f+='<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="'+e.core.s.dynamicEl[g].thumb+'" /></div></span>';else e.core.$items.each(function(){f+=e.core.s.exThumbImage?'<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="'+a(this).attr(e.core.s.exThumbImage)+'" /></div></span>':'<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="'+a(this).find("img").attr("src")+'" /></div></span>'});c=e.core.$outer.find(".lg-pager-outer"),c.html(f),b=e.core.$outer.find(".lg-pager-cont"),b.on("click.lg touchend.lg",function(){var b=a(this);e.core.index=b.index(),e.core.slide(e.core.index,!1,!0,!1)}),c.on("mouseover.lg",function(){clearTimeout(d),c.addClass("lg-pager-hover")}),c.on("mouseout.lg",function(){d=setTimeout(function(){c.removeClass("lg-pager-hover")})}),e.core.$el.on("onBeforeSlide.lg.tm",function(a,c,d){b.removeClass("lg-pager-active"),b.eq(d).addClass("lg-pager-active")})},c.prototype.destroy=function(){},a.fn.lightGallery.modules.pager=c}()});
|
@@ -0,0 +1,94 @@
|
|
1
|
+
/*! lg-share - v1.0.2 - 2016-11-26
|
2
|
+
* http://sachinchoolur.github.io/lightGallery
|
3
|
+
* Copyright (c) 2016 Sachin N; Licensed GPLv3 */
|
4
|
+
|
5
|
+
(function (root, factory) {
|
6
|
+
if (typeof define === 'function' && define.amd) {
|
7
|
+
// AMD. Register as an anonymous module unless amdModuleId is set
|
8
|
+
define(['jquery'], function (a0) {
|
9
|
+
return (factory(a0));
|
10
|
+
});
|
11
|
+
} else if (typeof exports === 'object') {
|
12
|
+
// Node. Does not work with strict CommonJS, but
|
13
|
+
// only CommonJS-like environments that support module.exports,
|
14
|
+
// like Node.
|
15
|
+
module.exports = factory(require('jquery'));
|
16
|
+
} else {
|
17
|
+
factory(jQuery);
|
18
|
+
}
|
19
|
+
}(this, function ($) {
|
20
|
+
|
21
|
+
(function() {
|
22
|
+
|
23
|
+
'use strict';
|
24
|
+
|
25
|
+
var defaults = {
|
26
|
+
share: true,
|
27
|
+
facebook: true,
|
28
|
+
facebookDropdownText: 'Facebook',
|
29
|
+
twitter: true,
|
30
|
+
twitterDropdownText: 'Twitter',
|
31
|
+
googlePlus: true,
|
32
|
+
googlePlusDropdownText: 'GooglePlus',
|
33
|
+
pinterest: true,
|
34
|
+
pinterestDropdownText: 'Pinterest'
|
35
|
+
};
|
36
|
+
|
37
|
+
var Share = function(element) {
|
38
|
+
|
39
|
+
this.core = $(element).data('lightGallery');
|
40
|
+
|
41
|
+
this.core.s = $.extend({}, defaults, this.core.s);
|
42
|
+
if (this.core.s.share) {
|
43
|
+
this.init();
|
44
|
+
}
|
45
|
+
|
46
|
+
return this;
|
47
|
+
};
|
48
|
+
|
49
|
+
Share.prototype.init = function() {
|
50
|
+
var _this = this;
|
51
|
+
var shareHtml = '<span id="lg-share" class="lg-icon">' +
|
52
|
+
'<ul class="lg-dropdown" style="position: absolute;">';
|
53
|
+
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>' : '';
|
54
|
+
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>' : '';
|
55
|
+
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>' : '';
|
56
|
+
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>' : '';
|
57
|
+
shareHtml += '</ul></span>';
|
58
|
+
|
59
|
+
this.core.$outer.find('.lg-toolbar').append(shareHtml);
|
60
|
+
this.core.$outer.find('.lg').append('<div id="lg-dropdown-overlay"></div>');
|
61
|
+
$('#lg-share').on('click.lg', function(){
|
62
|
+
_this.core.$outer.toggleClass('lg-dropdown-active');
|
63
|
+
});
|
64
|
+
|
65
|
+
$('#lg-dropdown-overlay').on('click.lg', function(){
|
66
|
+
_this.core.$outer.removeClass('lg-dropdown-active');
|
67
|
+
});
|
68
|
+
|
69
|
+
_this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex, index) {
|
70
|
+
|
71
|
+
setTimeout(function() {
|
72
|
+
$('#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)));
|
73
|
+
|
74
|
+
$('#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)));
|
75
|
+
|
76
|
+
$('#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)));
|
77
|
+
|
78
|
+
$('#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'));
|
79
|
+
|
80
|
+
}, 100);
|
81
|
+
});
|
82
|
+
};
|
83
|
+
|
84
|
+
Share.prototype.destroy = function() {
|
85
|
+
|
86
|
+
};
|
87
|
+
|
88
|
+
$.fn.lightGallery.modules.share = Share;
|
89
|
+
|
90
|
+
})();
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
}));
|
@@ -0,0 +1,4 @@
|
|
1
|
+
/*! lg-share - v1.0.2 - 2016-11-26
|
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={share:!0,facebook:!0,facebookDropdownText:"Facebook",twitter:!0,twitterDropdownText:"Twitter",googlePlus:!0,googlePlusDropdownText:"GooglePlus",pinterest:!0,pinterestDropdownText:"Pinterest"},c=function(c){return this.core=a(c).data("lightGallery"),this.core.s=a.extend({},b,this.core.s),this.core.s.share&&this.init(),this};c.prototype.init=function(){var b=this,c='<span id="lg-share" class="lg-icon"><ul class="lg-dropdown" style="position: absolute;">';c+=b.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>":"",c+=b.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>":"",c+=b.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>":"",c+=b.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>":"",c+="</ul></span>",this.core.$outer.find(".lg-toolbar").append(c),this.core.$outer.find(".lg").append('<div id="lg-dropdown-overlay"></div>'),a("#lg-share").on("click.lg",function(){b.core.$outer.toggleClass("lg-dropdown-active")}),a("#lg-dropdown-overlay").on("click.lg",function(){b.core.$outer.removeClass("lg-dropdown-active")}),b.core.$el.on("onAfterSlide.lg.tm",function(c,d,e){setTimeout(function(){a("#lg-share-facebook").attr("href","https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(b.core.$items.eq(e).attr("data-facebook-share-url")||window.location.href)),a("#lg-share-twitter").attr("href","https://twitter.com/intent/tweet?text="+b.core.$items.eq(e).attr("data-tweet-text")+"&url="+encodeURIComponent(b.core.$items.eq(e).attr("data-twitter-share-url")||window.location.href)),a("#lg-share-googleplus").attr("href","https://plus.google.com/share?url="+encodeURIComponent(b.core.$items.eq(e).attr("data-googleplus-share-url")||window.location.href)),a("#lg-share-pinterest").attr("href","http://www.pinterest.com/pin/create/button/?url="+encodeURIComponent(b.core.$items.eq(e).attr("data-pinterest-share-url")||window.location.href)+"&media="+encodeURIComponent(b.core.$items.eq(e).attr("href")||b.core.$items.eq(e).attr("data-src"))+"&description="+b.core.$items.eq(e).attr("data-pinterest-text"))},100)})},c.prototype.destroy=function(){},a.fn.lightGallery.modules.share=c}()});
|
@@ -0,0 +1,473 @@
|
|
1
|
+
/*! lg-thumbnail - v1.0.3 - 2017-02-05
|
2
|
+
* http://sachinchoolur.github.io/lightGallery
|
3
|
+
* Copyright (c) 2017 Sachin N; Licensed GPLv3 */
|
4
|
+
|
5
|
+
(function (root, factory) {
|
6
|
+
if (typeof define === 'function' && define.amd) {
|
7
|
+
// AMD. Register as an anonymous module unless amdModuleId is set
|
8
|
+
define(['jquery'], function (a0) {
|
9
|
+
return (factory(a0));
|
10
|
+
});
|
11
|
+
} else if (typeof exports === 'object') {
|
12
|
+
// Node. Does not work with strict CommonJS, but
|
13
|
+
// only CommonJS-like environments that support module.exports,
|
14
|
+
// like Node.
|
15
|
+
module.exports = factory(require('jquery'));
|
16
|
+
} else {
|
17
|
+
factory(jQuery);
|
18
|
+
}
|
19
|
+
}(this, function ($) {
|
20
|
+
|
21
|
+
(function() {
|
22
|
+
|
23
|
+
'use strict';
|
24
|
+
|
25
|
+
var defaults = {
|
26
|
+
thumbnail: true,
|
27
|
+
|
28
|
+
animateThumb: true,
|
29
|
+
currentPagerPosition: 'middle',
|
30
|
+
|
31
|
+
thumbWidth: 100,
|
32
|
+
thumbContHeight: 100,
|
33
|
+
thumbMargin: 5,
|
34
|
+
|
35
|
+
exThumbImage: false,
|
36
|
+
showThumbByDefault: true,
|
37
|
+
toogleThumb: true,
|
38
|
+
pullCaptionUp: true,
|
39
|
+
|
40
|
+
enableThumbDrag: true,
|
41
|
+
enableThumbSwipe: true,
|
42
|
+
swipeThreshold: 50,
|
43
|
+
|
44
|
+
loadYoutubeThumbnail: true,
|
45
|
+
youtubeThumbSize: 1,
|
46
|
+
|
47
|
+
loadVimeoThumbnail: true,
|
48
|
+
vimeoThumbSize: 'thumbnail_small',
|
49
|
+
|
50
|
+
loadDailymotionThumbnail: true
|
51
|
+
};
|
52
|
+
|
53
|
+
var Thumbnail = function(element) {
|
54
|
+
|
55
|
+
// get lightGallery core plugin data
|
56
|
+
this.core = $(element).data('lightGallery');
|
57
|
+
|
58
|
+
// extend module default settings with lightGallery core settings
|
59
|
+
this.core.s = $.extend({}, defaults, this.core.s);
|
60
|
+
|
61
|
+
this.$el = $(element);
|
62
|
+
this.$thumbOuter = null;
|
63
|
+
this.thumbOuterWidth = 0;
|
64
|
+
this.thumbTotalWidth = (this.core.$items.length * (this.core.s.thumbWidth + this.core.s.thumbMargin));
|
65
|
+
this.thumbIndex = this.core.index;
|
66
|
+
|
67
|
+
// Thumbnail animation value
|
68
|
+
this.left = 0;
|
69
|
+
|
70
|
+
this.init();
|
71
|
+
|
72
|
+
return this;
|
73
|
+
};
|
74
|
+
|
75
|
+
Thumbnail.prototype.init = function() {
|
76
|
+
var _this = this;
|
77
|
+
if (this.core.s.thumbnail && this.core.$items.length > 1) {
|
78
|
+
if (this.core.s.showThumbByDefault) {
|
79
|
+
setTimeout(function(){
|
80
|
+
_this.core.$outer.addClass('lg-thumb-open');
|
81
|
+
}, 700);
|
82
|
+
}
|
83
|
+
|
84
|
+
if (this.core.s.pullCaptionUp) {
|
85
|
+
this.core.$outer.addClass('lg-pull-caption-up');
|
86
|
+
}
|
87
|
+
|
88
|
+
this.build();
|
89
|
+
if (this.core.s.animateThumb) {
|
90
|
+
if (this.core.s.enableThumbDrag && !this.core.isTouch && this.core.doCss()) {
|
91
|
+
this.enableThumbDrag();
|
92
|
+
}
|
93
|
+
|
94
|
+
if (this.core.s.enableThumbSwipe && this.core.isTouch && this.core.doCss()) {
|
95
|
+
this.enableThumbSwipe();
|
96
|
+
}
|
97
|
+
|
98
|
+
this.thumbClickable = false;
|
99
|
+
} else {
|
100
|
+
this.thumbClickable = true;
|
101
|
+
}
|
102
|
+
|
103
|
+
this.toogle();
|
104
|
+
this.thumbkeyPress();
|
105
|
+
}
|
106
|
+
};
|
107
|
+
|
108
|
+
Thumbnail.prototype.build = function() {
|
109
|
+
var _this = this;
|
110
|
+
var thumbList = '';
|
111
|
+
var vimeoErrorThumbSize = '';
|
112
|
+
var $thumb;
|
113
|
+
var html = '<div class="lg-thumb-outer">' +
|
114
|
+
'<div class="lg-thumb lg-group">' +
|
115
|
+
'</div>' +
|
116
|
+
'</div>';
|
117
|
+
|
118
|
+
switch (this.core.s.vimeoThumbSize) {
|
119
|
+
case 'thumbnail_large':
|
120
|
+
vimeoErrorThumbSize = '640';
|
121
|
+
break;
|
122
|
+
case 'thumbnail_medium':
|
123
|
+
vimeoErrorThumbSize = '200x150';
|
124
|
+
break;
|
125
|
+
case 'thumbnail_small':
|
126
|
+
vimeoErrorThumbSize = '100x75';
|
127
|
+
}
|
128
|
+
|
129
|
+
_this.core.$outer.addClass('lg-has-thumb');
|
130
|
+
|
131
|
+
_this.core.$outer.find('.lg').append(html);
|
132
|
+
|
133
|
+
_this.$thumbOuter = _this.core.$outer.find('.lg-thumb-outer');
|
134
|
+
_this.thumbOuterWidth = _this.$thumbOuter.width();
|
135
|
+
|
136
|
+
if (_this.core.s.animateThumb) {
|
137
|
+
_this.core.$outer.find('.lg-thumb').css({
|
138
|
+
width: _this.thumbTotalWidth + 'px',
|
139
|
+
position: 'relative'
|
140
|
+
});
|
141
|
+
}
|
142
|
+
|
143
|
+
if (this.core.s.animateThumb) {
|
144
|
+
_this.$thumbOuter.css('height', _this.core.s.thumbContHeight + 'px');
|
145
|
+
}
|
146
|
+
|
147
|
+
function getThumb(src, thumb, index) {
|
148
|
+
var isVideo = _this.core.isVideo(src, index) || {};
|
149
|
+
var thumbImg;
|
150
|
+
var vimeoId = '';
|
151
|
+
|
152
|
+
if (isVideo.youtube || isVideo.vimeo || isVideo.dailymotion) {
|
153
|
+
if (isVideo.youtube) {
|
154
|
+
if (_this.core.s.loadYoutubeThumbnail) {
|
155
|
+
thumbImg = '//img.youtube.com/vi/' + isVideo.youtube[1] + '/' + _this.core.s.youtubeThumbSize + '.jpg';
|
156
|
+
} else {
|
157
|
+
thumbImg = thumb;
|
158
|
+
}
|
159
|
+
} else if (isVideo.vimeo) {
|
160
|
+
if (_this.core.s.loadVimeoThumbnail) {
|
161
|
+
thumbImg = '//i.vimeocdn.com/video/error_' + vimeoErrorThumbSize + '.jpg';
|
162
|
+
vimeoId = isVideo.vimeo[1];
|
163
|
+
} else {
|
164
|
+
thumbImg = thumb;
|
165
|
+
}
|
166
|
+
} else if (isVideo.dailymotion) {
|
167
|
+
if (_this.core.s.loadDailymotionThumbnail) {
|
168
|
+
thumbImg = '//www.dailymotion.com/thumbnail/video/' + isVideo.dailymotion[1];
|
169
|
+
} else {
|
170
|
+
thumbImg = thumb;
|
171
|
+
}
|
172
|
+
}
|
173
|
+
} else {
|
174
|
+
thumbImg = thumb;
|
175
|
+
}
|
176
|
+
|
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>';
|
178
|
+
vimeoId = '';
|
179
|
+
}
|
180
|
+
|
181
|
+
if (_this.core.s.dynamic) {
|
182
|
+
for (var i = 0; i < _this.core.s.dynamicEl.length; i++) {
|
183
|
+
getThumb(_this.core.s.dynamicEl[i].src, _this.core.s.dynamicEl[i].thumb, i);
|
184
|
+
}
|
185
|
+
} else {
|
186
|
+
_this.core.$items.each(function(i) {
|
187
|
+
|
188
|
+
if (!_this.core.s.exThumbImage) {
|
189
|
+
getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).find('img').attr('src'), i);
|
190
|
+
} else {
|
191
|
+
getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).attr(_this.core.s.exThumbImage), i);
|
192
|
+
}
|
193
|
+
|
194
|
+
});
|
195
|
+
}
|
196
|
+
|
197
|
+
_this.core.$outer.find('.lg-thumb').html(thumbList);
|
198
|
+
|
199
|
+
$thumb = _this.core.$outer.find('.lg-thumb-item');
|
200
|
+
|
201
|
+
// Load vimeo thumbnails
|
202
|
+
$thumb.each(function() {
|
203
|
+
var $this = $(this);
|
204
|
+
var vimeoVideoId = $this.attr('data-vimeo-id');
|
205
|
+
|
206
|
+
if (vimeoVideoId) {
|
207
|
+
$.getJSON('//www.vimeo.com/api/v2/video/' + vimeoVideoId + '.json?callback=?', {
|
208
|
+
format: 'json'
|
209
|
+
}, function(data) {
|
210
|
+
$this.find('img').attr('src', data[0][_this.core.s.vimeoThumbSize]);
|
211
|
+
});
|
212
|
+
}
|
213
|
+
});
|
214
|
+
|
215
|
+
// manage active class for thumbnail
|
216
|
+
$thumb.eq(_this.core.index).addClass('active');
|
217
|
+
_this.core.$el.on('onBeforeSlide.lg.tm', function() {
|
218
|
+
$thumb.removeClass('active');
|
219
|
+
$thumb.eq(_this.core.index).addClass('active');
|
220
|
+
});
|
221
|
+
|
222
|
+
$thumb.on('click.lg touchend.lg', function() {
|
223
|
+
var _$this = $(this);
|
224
|
+
setTimeout(function() {
|
225
|
+
|
226
|
+
// In IE9 and bellow touch does not support
|
227
|
+
// Go to slide if browser does not support css transitions
|
228
|
+
if ((_this.thumbClickable && !_this.core.lgBusy) || !_this.core.doCss()) {
|
229
|
+
_this.core.index = _$this.index();
|
230
|
+
_this.core.slide(_this.core.index, false, true, false);
|
231
|
+
}
|
232
|
+
}, 50);
|
233
|
+
});
|
234
|
+
|
235
|
+
_this.core.$el.on('onBeforeSlide.lg.tm', function() {
|
236
|
+
_this.animateThumb(_this.core.index);
|
237
|
+
});
|
238
|
+
|
239
|
+
$(window).on('resize.lg.thumb orientationchange.lg.thumb', function() {
|
240
|
+
setTimeout(function() {
|
241
|
+
_this.animateThumb(_this.core.index);
|
242
|
+
_this.thumbOuterWidth = _this.$thumbOuter.width();
|
243
|
+
}, 200);
|
244
|
+
});
|
245
|
+
|
246
|
+
};
|
247
|
+
|
248
|
+
Thumbnail.prototype.setTranslate = function(value) {
|
249
|
+
// jQuery supports Automatic CSS prefixing since jQuery 1.8.0
|
250
|
+
this.core.$outer.find('.lg-thumb').css({
|
251
|
+
transform: 'translate3d(-' + (value) + 'px, 0px, 0px)'
|
252
|
+
});
|
253
|
+
};
|
254
|
+
|
255
|
+
Thumbnail.prototype.animateThumb = function(index) {
|
256
|
+
var $thumb = this.core.$outer.find('.lg-thumb');
|
257
|
+
if (this.core.s.animateThumb) {
|
258
|
+
var position;
|
259
|
+
switch (this.core.s.currentPagerPosition) {
|
260
|
+
case 'left':
|
261
|
+
position = 0;
|
262
|
+
break;
|
263
|
+
case 'middle':
|
264
|
+
position = (this.thumbOuterWidth / 2) - (this.core.s.thumbWidth / 2);
|
265
|
+
break;
|
266
|
+
case 'right':
|
267
|
+
position = this.thumbOuterWidth - this.core.s.thumbWidth;
|
268
|
+
}
|
269
|
+
this.left = ((this.core.s.thumbWidth + this.core.s.thumbMargin) * index - 1) - position;
|
270
|
+
if (this.left > (this.thumbTotalWidth - this.thumbOuterWidth)) {
|
271
|
+
this.left = this.thumbTotalWidth - this.thumbOuterWidth;
|
272
|
+
}
|
273
|
+
|
274
|
+
if (this.left < 0) {
|
275
|
+
this.left = 0;
|
276
|
+
}
|
277
|
+
|
278
|
+
if (this.core.lGalleryOn) {
|
279
|
+
if (!$thumb.hasClass('on')) {
|
280
|
+
this.core.$outer.find('.lg-thumb').css('transition-duration', this.core.s.speed + 'ms');
|
281
|
+
}
|
282
|
+
|
283
|
+
if (!this.core.doCss()) {
|
284
|
+
$thumb.animate({
|
285
|
+
left: -this.left + 'px'
|
286
|
+
}, this.core.s.speed);
|
287
|
+
}
|
288
|
+
} else {
|
289
|
+
if (!this.core.doCss()) {
|
290
|
+
$thumb.css('left', -this.left + 'px');
|
291
|
+
}
|
292
|
+
}
|
293
|
+
|
294
|
+
this.setTranslate(this.left);
|
295
|
+
|
296
|
+
}
|
297
|
+
};
|
298
|
+
|
299
|
+
// Enable thumbnail dragging and swiping
|
300
|
+
Thumbnail.prototype.enableThumbDrag = function() {
|
301
|
+
|
302
|
+
var _this = this;
|
303
|
+
var startCoords = 0;
|
304
|
+
var endCoords = 0;
|
305
|
+
var isDraging = false;
|
306
|
+
var isMoved = false;
|
307
|
+
var tempLeft = 0;
|
308
|
+
|
309
|
+
_this.$thumbOuter.addClass('lg-grab');
|
310
|
+
|
311
|
+
_this.core.$outer.find('.lg-thumb').on('mousedown.lg.thumb', function(e) {
|
312
|
+
if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
|
313
|
+
// execute only on .lg-object
|
314
|
+
e.preventDefault();
|
315
|
+
startCoords = e.pageX;
|
316
|
+
isDraging = true;
|
317
|
+
|
318
|
+
// ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
|
319
|
+
_this.core.$outer.scrollLeft += 1;
|
320
|
+
_this.core.$outer.scrollLeft -= 1;
|
321
|
+
|
322
|
+
// *
|
323
|
+
_this.thumbClickable = false;
|
324
|
+
_this.$thumbOuter.removeClass('lg-grab').addClass('lg-grabbing');
|
325
|
+
}
|
326
|
+
});
|
327
|
+
|
328
|
+
$(window).on('mousemove.lg.thumb', function(e) {
|
329
|
+
if (isDraging) {
|
330
|
+
tempLeft = _this.left;
|
331
|
+
isMoved = true;
|
332
|
+
endCoords = e.pageX;
|
333
|
+
|
334
|
+
_this.$thumbOuter.addClass('lg-dragging');
|
335
|
+
|
336
|
+
tempLeft = tempLeft - (endCoords - startCoords);
|
337
|
+
|
338
|
+
if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) {
|
339
|
+
tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
|
340
|
+
}
|
341
|
+
|
342
|
+
if (tempLeft < 0) {
|
343
|
+
tempLeft = 0;
|
344
|
+
}
|
345
|
+
|
346
|
+
// move current slide
|
347
|
+
_this.setTranslate(tempLeft);
|
348
|
+
|
349
|
+
}
|
350
|
+
});
|
351
|
+
|
352
|
+
$(window).on('mouseup.lg.thumb', function() {
|
353
|
+
if (isMoved) {
|
354
|
+
isMoved = false;
|
355
|
+
_this.$thumbOuter.removeClass('lg-dragging');
|
356
|
+
|
357
|
+
_this.left = tempLeft;
|
358
|
+
|
359
|
+
if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
|
360
|
+
_this.thumbClickable = true;
|
361
|
+
}
|
362
|
+
|
363
|
+
} else {
|
364
|
+
_this.thumbClickable = true;
|
365
|
+
}
|
366
|
+
|
367
|
+
if (isDraging) {
|
368
|
+
isDraging = false;
|
369
|
+
_this.$thumbOuter.removeClass('lg-grabbing').addClass('lg-grab');
|
370
|
+
}
|
371
|
+
});
|
372
|
+
|
373
|
+
};
|
374
|
+
|
375
|
+
Thumbnail.prototype.enableThumbSwipe = function() {
|
376
|
+
var _this = this;
|
377
|
+
var startCoords = 0;
|
378
|
+
var endCoords = 0;
|
379
|
+
var isMoved = false;
|
380
|
+
var tempLeft = 0;
|
381
|
+
|
382
|
+
_this.core.$outer.find('.lg-thumb').on('touchstart.lg', function(e) {
|
383
|
+
if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
|
384
|
+
e.preventDefault();
|
385
|
+
startCoords = e.originalEvent.targetTouches[0].pageX;
|
386
|
+
_this.thumbClickable = false;
|
387
|
+
}
|
388
|
+
});
|
389
|
+
|
390
|
+
_this.core.$outer.find('.lg-thumb').on('touchmove.lg', function(e) {
|
391
|
+
if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
|
392
|
+
e.preventDefault();
|
393
|
+
endCoords = e.originalEvent.targetTouches[0].pageX;
|
394
|
+
isMoved = true;
|
395
|
+
|
396
|
+
_this.$thumbOuter.addClass('lg-dragging');
|
397
|
+
|
398
|
+
tempLeft = _this.left;
|
399
|
+
|
400
|
+
tempLeft = tempLeft - (endCoords - startCoords);
|
401
|
+
|
402
|
+
if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) {
|
403
|
+
tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
|
404
|
+
}
|
405
|
+
|
406
|
+
if (tempLeft < 0) {
|
407
|
+
tempLeft = 0;
|
408
|
+
}
|
409
|
+
|
410
|
+
// move current slide
|
411
|
+
_this.setTranslate(tempLeft);
|
412
|
+
|
413
|
+
}
|
414
|
+
});
|
415
|
+
|
416
|
+
_this.core.$outer.find('.lg-thumb').on('touchend.lg', function() {
|
417
|
+
if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
|
418
|
+
|
419
|
+
if (isMoved) {
|
420
|
+
isMoved = false;
|
421
|
+
_this.$thumbOuter.removeClass('lg-dragging');
|
422
|
+
if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
|
423
|
+
_this.thumbClickable = true;
|
424
|
+
}
|
425
|
+
|
426
|
+
_this.left = tempLeft;
|
427
|
+
} else {
|
428
|
+
_this.thumbClickable = true;
|
429
|
+
}
|
430
|
+
} else {
|
431
|
+
_this.thumbClickable = true;
|
432
|
+
}
|
433
|
+
});
|
434
|
+
|
435
|
+
};
|
436
|
+
|
437
|
+
Thumbnail.prototype.toogle = function() {
|
438
|
+
var _this = this;
|
439
|
+
if (_this.core.s.toogleThumb) {
|
440
|
+
_this.core.$outer.addClass('lg-can-toggle');
|
441
|
+
_this.$thumbOuter.append('<span class="lg-toogle-thumb lg-icon"></span>');
|
442
|
+
_this.core.$outer.find('.lg-toogle-thumb').on('click.lg', function() {
|
443
|
+
_this.core.$outer.toggleClass('lg-thumb-open');
|
444
|
+
});
|
445
|
+
}
|
446
|
+
};
|
447
|
+
|
448
|
+
Thumbnail.prototype.thumbkeyPress = function() {
|
449
|
+
var _this = this;
|
450
|
+
$(window).on('keydown.lg.thumb', function(e) {
|
451
|
+
if (e.keyCode === 38) {
|
452
|
+
e.preventDefault();
|
453
|
+
_this.core.$outer.addClass('lg-thumb-open');
|
454
|
+
} else if (e.keyCode === 40) {
|
455
|
+
e.preventDefault();
|
456
|
+
_this.core.$outer.removeClass('lg-thumb-open');
|
457
|
+
}
|
458
|
+
});
|
459
|
+
};
|
460
|
+
|
461
|
+
Thumbnail.prototype.destroy = function() {
|
462
|
+
if (this.core.s.thumbnail && this.core.$items.length > 1) {
|
463
|
+
$(window).off('resize.lg.thumb orientationchange.lg.thumb keydown.lg.thumb');
|
464
|
+
this.$thumbOuter.remove();
|
465
|
+
this.core.$outer.removeClass('lg-has-thumb');
|
466
|
+
}
|
467
|
+
};
|
468
|
+
|
469
|
+
$.fn.lightGallery.modules.Thumbnail = Thumbnail;
|
470
|
+
|
471
|
+
})();
|
472
|
+
|
473
|
+
}));
|