assets-rails 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/README.md +13 -9
- data/assets-rails.gemspec +2 -0
- data/lib/assets-rails/engine.rb +3 -1
- data/lib/assets-rails/version.rb +1 -1
- data/vendor/assets/fonts/lightgallery/Slide-icons.dev.svg +33 -0
- data/vendor/assets/fonts/lightgallery/Slide-icons.eot +0 -0
- data/vendor/assets/fonts/lightgallery/Slide-icons.svg +33 -0
- data/vendor/assets/fonts/lightgallery/Slide-icons.ttf +0 -0
- data/vendor/assets/fonts/lightgallery/Slide-icons.woff +0 -0
- data/vendor/assets/fonts/photoswipe/v4.0.0/default-skin/default-skin.svg +38 -0
- data/vendor/assets/fonts/photoswipe/v4.0.2/default-skin/default-skin.svg +1 -0
- data/vendor/assets/images/jquery.share/social-icons-sprite.png +0 -0
- data/vendor/assets/images/jquery.share/social-icons.png +0 -0
- data/vendor/assets/images/lightgallery/loading.gif +0 -0
- data/vendor/assets/images/photoswipe/v4.0.0/default-skin/default-skin.png +0 -0
- data/vendor/assets/images/photoswipe/v4.0.0/default-skin/preloader.gif +0 -0
- data/vendor/assets/images/photoswipe/v4.0.2/default-skin/default-skin.png +0 -0
- data/vendor/assets/images/photoswipe/v4.0.2/default-skin/preloader.gif +0 -0
- data/vendor/assets/javascripts/imagesloaded/v3.1.8.js +1 -1
- data/vendor/assets/javascripts/imagesloaded/v3.1.8/imagesloaded.js +561 -3
- data/vendor/assets/javascripts/jquery.cookie/v1.4.1.js +2 -0
- data/vendor/assets/javascripts/jquery.cookie/v1.4.1/jquery.cookie.js +117 -0
- data/vendor/assets/javascripts/jquery.share.js +1 -0
- data/vendor/assets/javascripts/jquery.share/jquery.share.js +137 -0
- data/vendor/assets/javascripts/jquery.zoom/v1.7.13.js +1 -0
- data/vendor/assets/javascripts/jquery.zoom/v1.7.13/jquery.zoom.js +233 -0
- data/vendor/assets/javascripts/lightgallery/v1.1.4.js +1 -0
- data/vendor/assets/javascripts/lightgallery/v1.1.4/lightgallery.min.js +11 -0
- data/vendor/assets/javascripts/photoswipe/v4.0.0.js +2 -0
- data/vendor/assets/javascripts/photoswipe/v4.0.0/photoswipe-ui-default.js +824 -0
- data/vendor/assets/javascripts/photoswipe/v4.0.0/photoswipe.js +3647 -0
- data/vendor/assets/javascripts/photoswipe/v4.0.2.js +2 -0
- data/vendor/assets/javascripts/photoswipe/v4.0.2/photoswipe-ui-default.js +792 -0
- data/vendor/assets/javascripts/photoswipe/v4.0.2/photoswipe.js +3589 -0
- data/vendor/assets/stylesheets/font-awesome/v4.2.0/_variables.scss +1 -1
- data/vendor/assets/stylesheets/jquery.collageplus/v0.3.3/transitions.css +202 -0
- data/vendor/assets/stylesheets/jquery.share.css +3 -0
- data/vendor/assets/stylesheets/jquery.share/jquery.share.scss +215 -0
- data/vendor/assets/stylesheets/lightgallery/v1.1.4/lightgallery.scss +629 -0
- data/vendor/assets/stylesheets/photoswipe/v4.0.0.css +3 -0
- data/vendor/assets/stylesheets/photoswipe/v4.0.0/default-skin.scss +418 -0
- data/vendor/assets/stylesheets/photoswipe/v4.0.0/photoswipe.css +125 -0
- data/vendor/assets/stylesheets/photoswipe/v4.0.2.css +3 -0
- data/vendor/assets/stylesheets/photoswipe/v4.0.2/default-skin.scss +390 -0
- data/vendor/assets/stylesheets/photoswipe/v4.0.2/photoswipe.css +148 -0
- metadata +43 -5
@@ -0,0 +1 @@
|
|
1
|
+
//= require lightgallery/v1.1.4/lightgallery.min
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/** ==========================================================
|
2
|
+
|
3
|
+
* jquery lightGallery.js v1.1.4 : Yoolk.InstantWebsite Custome
|
4
|
+
* Change defuatl behavior from data source find by <img src=""> change to attr('data-src') render to render thumbnail in popup line: 456.
|
5
|
+
|
6
|
+
-------------------------- Original Library------------------
|
7
|
+
* http://sachinchoolur.github.io/lightGallery/
|
8
|
+
* Released under the MIT License - http://opensource.org/licenses/mit-license.html ---- FREE ----
|
9
|
+
|
10
|
+
=========================================================/**/
|
11
|
+
(function(e){"use strict";e.fn.lightGallery=function(t){var n={mode:"slide",useCSS:true,cssEasing:"ease",easing:"linear",speed:600,addClass:"",closable:true,loop:false,auto:false,pause:4e3,escKey:true,controls:true,hideControlOnEnd:false,preload:1,showAfterLoad:true,selector:null,index:false,lang:{allPhotos:"All photos"},counter:false,exThumbImage:false,thumbnail:true,showThumbByDefault:false,animateThumb:true,currentPagerPosition:"middle",thumbWidth:100,thumbMargin:5,mobileSrc:false,mobileSrcMaxWidth:640,swipeThreshold:50,enableTouch:true,enableDrag:true,vimeoColor:"CCCCCC",videoAutoplay:true,videoMaxWidth:"855px",dynamic:false,dynamicEl:[],onOpen:function(e){},onSlideBefore:function(e){},onSlideAfter:function(e){},onSlideNext:function(e){},onSlidePrev:function(e){},onBeforeClose:function(e){},onCloseAfter:function(e){}},r=e(this),i=this,s=null,o=0,u=false,a=false,f=document.createTouch!==undefined||"ontouchstart"in window||"onmsgesturechange"in window||navigator.msMaxTouchPoints,l,c,h,p,d,v,m,g,y,b,w,E=false,S=false,x=false;var T=e.extend(true,{},n,t);var N={init:function(){r.each(function(){var t=e(this);if(T.dynamic){s=T.dynamicEl;o=0;m=o;C.init(o)}else{if(T.selector!==null){s=e(T.selector)}else{s=t.children()}s.on("click",function(n){if(T.selector!==null){s=e(T.selector)}else{s=t.children()}n.preventDefault();n.stopPropagation();o=s.index(this);m=o;C.init(o)})}})}};var C={init:function(){u=true;this.structure();this.getWidth();this.closeSlide();this.autoStart();this.counter();this.slideTo();this.buildThumbnail();this.keyPress();if(T.index){this.slide(T.index);this.animateThumb(T.index)}else{this.slide(o);this.animateThumb(o)}if(T.enableDrag){this.touch()}if(T.enableTouch){this.enableTouch()}setTimeout(function(){l.addClass("opacity")},50)},structure:function(){e("body").append('<div id="lightGallery-outer" class="'+T.addClass+'"><div id="lightGallery-Gallery"><div id="lightGallery-slider"></div><a id="lightGallery-close" class="close"></a></div></div>').addClass("lightGallery");c=e("#lightGallery-outer");l=e("#lightGallery-Gallery");if(T.showAfterLoad===true){l.addClass("showAfterLoad")}h=l.find("#lightGallery-slider");var t="";if(T.dynamic){for(var n=0;n<T.dynamicEl.length;n++){t+='<div class="lightGallery-slide"></div>'}}else{s.each(function(){t+='<div class="lightGallery-slide"></div>'})}h.append(t);p=l.find(".lightGallery-slide")},closeSlide:function(){var t=this;if(T.closable){e("#lightGallery-outer").on("click",function(t){if(e(t.target).is(".lightGallery-slide")){i.destroy(false)}})}e("#lightGallery-close").bind("click touchend",function(){i.destroy(false)})},getWidth:function(){var t=function(){b=e(window).width()};e(window).bind("resize.lightGallery",t())},doCss:function(){var e=function(){var e=["transition","MozTransition","WebkitTransition","OTransition","msTransition","KhtmlTransition"];var t=document.documentElement;for(var n=0;n<e.length;n++){if(e[n]in t.style){return true}}};if(T.useCSS&&e()){return true}return false},enableTouch:function(){var t=this;if(f){var n={},r={};e("body").on("touchstart.lightGallery",function(e){r=e.originalEvent.targetTouches[0];n.pageX=e.originalEvent.targetTouches[0].pageX;n.pageY=e.originalEvent.targetTouches[0].pageY});e("body").on("touchmove.lightGallery",function(e){var t=e.originalEvent;r=t.targetTouches[0];e.preventDefault()});e("body").on("touchend.lightGallery",function(e){var i=r.pageX-n.pageX,s=T.swipeThreshold;if(i>=s){t.prevSlide();clearInterval(w)}else if(i<=-s){t.nextSlide();clearInterval(w)}})}},touch:function(){var t,n;var r=this;e(".lightGallery").bind("mousedown",function(e){e.stopPropagation();e.preventDefault();t=e.pageX});e(".lightGallery").bind("mouseup",function(e){e.stopPropagation();e.preventDefault();n=e.pageX;if(n-t>20){r.prevSlide()}else if(t-n>20){r.nextSlide()}})},isVideo:function(e,t){var n=e.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9_\-]+)/i);var r=e.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i);var i=false;if(T.dynamic){if(T.dynamicEl[t].iframe=="true"){i=true}}else{if(s.eq(t).attr("data-iframe")=="true"){i=true}}if(n||r||i){return true}},loadVideo:function(e,t){var n=e.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9_\-]+)/i);var r=e.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i);var i="";var s="";if(n){if(T.videoAutoplay===true&&a===false){s="?autoplay=1&rel=0&wmode=opaque"}else{s="?wmode=opaque"}i='<iframe class="object" width="560" height="315" src="//www.youtube.com/embed/'+n[1]+s+'" frameborder="0" allowfullscreen></iframe>'}else if(r){if(T.videoAutoplay===true&&a===false){s="autoplay=1&"}else{s=""}i='<iframe class="object" id="video'+t+'" width="560" height="315" src="http://player.vimeo.com/video/'+r[1]+"?"+s+"byline=0&portrait=0&color="+T.vimeoColor+'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'}else{i='<iframe class="object" frameborder="0" src="'+e+'" allowfullscreen="true"></iframe>'}return'<div class="video_cont" style="max-width:'+T.videoMaxWidth+' !important;"><div class="video">'+i+"</div></div>"},addHtml:function(t){var n=null;if(T.dynamic){n=T.dynamicEl[t]["sub-html"]}else{n=s.eq(t).attr("data-sub-html")}if(typeof n!=="undefined"&&n!==null){var r=n.substring(0,1);if(r=="."||r=="#"){n=e(n).html()}else{n=n}p.eq(t).append(n)}},preload:function(e){var t=e;for(var n=0;n<=T.preload;n++){if(n>=s.length-e){break}this.loadContent(t+n,true)}for(var r=0;r<=T.preload;r++){if(t-r<0){break}this.loadContent(t-r,true)}},loadObj:function(e,t){var n=this;p.eq(t).find(".object").on("load error",function(){p.eq(t).addClass("complete")});if(e===false){if(!p.eq(t).hasClass("complete")){p.eq(t).find(".object").on("load error",function(){n.preload(t)})}else{n.preload(t)}}},loadContent:function(t,n){var r=this;var i,o,u=s.length-t;var a;if(T.preload>s.length){T.preload=s.length}if(T.mobileSrc===true&&b<=T.mobileSrcMaxWidth){if(T.dynamic){a=T.dynamicEl[t].mobileSrc}else{a=s.eq(t).attr("data-responsive-src")}}else{if(T.dynamic){a=T.dynamicEl[t].src}else{a=s.eq(t).attr("data-src")}}var f=0;if(n===true){f=T.speed+400}if(typeof a!=="undefined"&&a!==""){if(!r.isVideo(a,t)){setTimeout(function(){if(!p.eq(t).hasClass("loaded")){p.eq(t).prepend('<img class="object" src="'+a+'" />');r.addHtml(t);p.eq(t).addClass("loaded")}r.loadObj(n,t)},f)}else{setTimeout(function(){if(!p.eq(t).hasClass("loaded")){p.eq(t).prepend(r.loadVideo(a,t));r.addHtml(t);p.eq(t).addClass("loaded");if(T.auto&&T.videoAutoplay===true){clearInterval(w)}}r.loadObj(n,t)},f)}}else{setTimeout(function(){if(!p.eq(t).hasClass("loaded")){var i=null;if(T.dynamic){i=T.dynamicEl[t].html}else{i=s.eq(t).attr("data-html")}if(typeof i!=="undefined"&&i!==null){var o=i.substring(0,1);if(o=="."||o=="#"){i=e(i).html()}else{i=i}}if(typeof i!=="undefined"&&i!==null){p.eq(t).append('<div class="video_cont" style="max-width:'+T.videoMaxWidth+' !important;"><div class="video">'+i+"</div></div>")}r.addHtml(t);p.eq(t).addClass("loaded complete");if(T.auto&&T.videoAutoplay===true){clearInterval(w)}}r.loadObj(n,t)},f)}},counter:function(){if(T.counter===true){var t=e("#lightGallery-slider > div").length;l.append("<div id='lightGallery_counter'><span id='lightGallery_counter_current'></span> / <span id='lightGallery_counter_all'>"+t+"</span></div>")}},buildThumbnail:function(){if(T.thumbnail===true&&s.length>1){var t=this,n="";if(!T.showThumbByDefault){n='<span class="close ib"><i class="bUi-iCn-rMv-16" aria-hidden="true"></i></span>'}l.append('<div class="thumb_cont"><div class="thumb_info">'+n+'</div><div class="thumb_inner"></div></div>');g=l.find(".thumb_cont");d.after('<a class="cLthumb"></a>');d.parent().addClass("hasThumb");l.find(".cLthumb").bind("click touchend",function(){l.addClass("open");if(t.doCss()&&T.mode==="slide"){p.eq(o).prevAll().removeClass("nextSlide").addClass("prevSlide");p.eq(o).nextAll().removeClass("prevSlide").addClass("nextSlide")}});l.find(".thumb_cont .close").bind("click touchend",function(){l.removeClass("open")});var r=l.find(".thumb_info");var i=l.find(".thumb_inner");var u="";var a;if(T.dynamic){for(var f=0;f<T.dynamicEl.length;f++){a=T.dynamicEl[f].thumb;u+='<div class="thumb"><img src="'+a+'" /></div>'}}else{s.each(function(){if(T.exThumbImage===false||typeof e(this).attr(T.exThumbImage)=="undefined"||e(this).attr(T.exThumbImage)===null){a=e(this).attr("data-src")}else{a=e(this).attr(T.exThumbImage)}u+='<div class="thumb"><img src="'+a+'" /></div>'})}i.append(u);y=i.find(".thumb");y.css({"margin-right":T.thumbMargin+"px",width:T.thumbWidth+"px"});if(T.animateThumb===true){var c=s.length*(T.thumbWidth+T.thumbMargin);l.find(".thumb_inner").css({width:c+"px",position:"relative","transition-duration":T.speed+"ms"})}y.bind("click touchend",function(){E=true;var n=e(this).index();y.removeClass("active");e(this).addClass("active");t.slide(n);t.animateThumb(n);clearInterval(w)});r.prepend('<span class="ib count">'+T.lang.allPhotos+" ("+y.length+")</span>");if(T.showThumbByDefault){l.addClass("open")}}},animateThumb:function(e){if(T.animateThumb===true){var t=l.find(".thumb_cont").width();var n;switch(T.currentPagerPosition){case"left":n=0;break;case"middle":n=t/2-T.thumbWidth/2;break;case"right":n=t-T.thumbWidth}var r=(T.thumbWidth+T.thumbMargin)*e-1-n;var i=s.length*(T.thumbWidth+T.thumbMargin);if(r>i-t){r=i-t}if(r<0){r=0}if(this.doCss()){l.find(".thumb_inner").css("transform","translate3d(-"+r+"px, 0px, 0px)")}else{l.find(".thumb_inner").animate({left:-r+"px"},T.speed)}}},slideTo:function(){var e=this;if(T.controls===true&&s.length>1){l.append('<div id="lightGallery-action"><a id="lightGallery-prev"></a><a id="lightGallery-next"></a></div>');d=l.find("#lightGallery-prev");v=l.find("#lightGallery-next");d.bind("click",function(){e.prevSlide();clearInterval(w)});v.bind("click",function(){e.nextSlide();clearInterval(w)})}},autoStart:function(){var e=this;if(T.auto===true){w=setInterval(function(){if(o+1<s.length){o=o}else{o=-1}o++;e.slide(o)},T.pause)}},keyPress:function(){var t=this;e(window).bind("keyup.lightGallery",function(e){e.preventDefault();e.stopPropagation();if(e.keyCode===37){t.prevSlide();clearInterval(w)}if(e.keyCode===38&&T.thumbnail===true&&s.length>1){if(!l.hasClass("open")){if(t.doCss()&&T.mode==="slide"){p.eq(o).prevAll().removeClass("nextSlide").addClass("prevSlide");p.eq(o).nextAll().removeClass("prevSlide").addClass("nextSlide")}l.addClass("open")}}else if(e.keyCode===39){t.nextSlide();clearInterval(w)}if(e.keyCode===40&&T.thumbnail===true&&s.length>1&&!T.showThumbByDefault){if(l.hasClass("open")){l.removeClass("open")}}else if(T.escKey===true&&e.keyCode===27){if(!T.showThumbByDefault&&l.hasClass("open")){l.removeClass("open")}else{i.destroy(false)}}})},nextSlide:function(){var e=this;o=p.index(p.eq(m));if(o+1<s.length){o++;e.slide(o)}else{if(T.loop){o=0;e.slide(o)}else if(T.thumbnail===true&&s.length>1&&!T.showThumbByDefault){l.addClass("open")}else{p.eq(o).find(".object").addClass("rightEnd");setTimeout(function(){p.find(".object").removeClass("rightEnd")},400)}}e.animateThumb(o);T.onSlideNext.call(this,i)},prevSlide:function(){var e=this;o=p.index(p.eq(m));if(o>0){o--;e.slide(o)}else{if(T.loop){o=s.length-1;e.slide(o)}else if(T.thumbnail===true&&s.length>1&&!T.showThumbByDefault){l.addClass("open")}else{p.eq(o).find(".object").addClass("leftEnd");setTimeout(function(){p.find(".object").removeClass("leftEnd")},400)}}e.animateThumb(o);T.onSlidePrev.call(this,i)},slide:function(t){var n=this;if(a){setTimeout(function(){n.loadContent(t,false)},T.speed+400);if(!h.hasClass("on")){h.addClass("on")}if(this.doCss()&&T.speed!==""){if(!h.hasClass("speed")){h.addClass("speed")}if(x===false){h.css("transition-duration",T.speed+"ms");x=true}}if(this.doCss()&&T.cssEasing!==""){if(!h.hasClass("timing")){h.addClass("timing")}if(S===false){h.css("transition-timing-function",T.cssEasing);S=true}}T.onSlideBefore.call(this,i)}else{n.loadContent(t,false)}if(T.mode==="slide"){var r=navigator.userAgent.match(/iPad/i)!==null;if(this.doCss()&&!h.hasClass("slide")&&!r){h.addClass("slide")}else if(this.doCss()&&!h.hasClass("useLeft")&&r){h.addClass("useLeft")}if(!this.doCss()&&!a){h.css({left:-t*100+"%"})}else if(!this.doCss()&&a){h.animate({left:-t*100+"%"},T.speed,T.easing)}}else if(T.mode==="fade"){if(this.doCss()&&!h.hasClass("fadeM")){h.addClass("fadeM")}else if(!this.doCss()&&!h.hasClass("animate")){h.addClass("animate")}if(!this.doCss()&&!a){p.fadeOut(100);p.eq(t).fadeIn(100)}else if(!this.doCss()&&a){p.eq(m).fadeOut(T.speed,T.easing);p.eq(t).fadeIn(T.speed,T.easing)}}if(t+1>=s.length&&T.auto&&T.loop===false){clearInterval(w)}p.eq(m).removeClass("current");p.eq(t).addClass("current");if(this.doCss()&&T.mode==="slide"){if(E===false){e(".prevSlide").removeClass("prevSlide");e(".nextSlide").removeClass("nextSlide");p.eq(t-1).addClass("prevSlide");p.eq(t+1).addClass("nextSlide")}else{p.eq(t).prevAll().removeClass("nextSlide").addClass("prevSlide");p.eq(t).nextAll().removeClass("prevSlide").addClass("nextSlide")}}if(T.thumbnail===true&&s.length>1){y.removeClass("active");y.eq(t).addClass("active")}if(T.controls&&T.hideControlOnEnd&&T.loop===false&&s.length>1){var o=s.length;o=parseInt(o)-1;if(t===0){d.addClass("disabled");v.removeClass("disabled")}else if(t===o){d.removeClass("disabled");v.addClass("disabled")}else{d.add(v).removeClass("disabled")}}m=t;a===false?T.onOpen.call(this,i):T.onSlideAfter.call(this,i);setTimeout(function(){a=true});E=false;if(T.counter){e("#lightGallery_counter_current").text(t+1)}e(window).bind("resize.lightGallery",function(){setTimeout(function(){n.animateThumb(t)},200)})}};i.isActive=function(){if(u===true){return true}else{return false}};i.destroy=function(t){u=false;t=typeof t!=="undefined"?false:true;T.onBeforeClose.call(this,i);var n=a;a=false;S=false;x=false;E=false;clearInterval(w);if(t===true){s.off("click touch touchstart")}e(".lightGallery").off("mousedown mouseup");e("body").off("touchstart.lightGallery touchmove.lightGallery touchend.lightGallery");e(window).off("resize.lightGallery keyup.lightGallery");if(n===true){l.addClass("fadeM");setTimeout(function(){c.remove();e("body").removeClass("lightGallery")},500)}T.onCloseAfter.call(this,i)};N.init();return this}})(jQuery)
|
@@ -0,0 +1,824 @@
|
|
1
|
+
/*! PhotoSwipe Default UI - 4.0.0 - 2014-12-05
|
2
|
+
* http://photoswipe.com
|
3
|
+
* Copyright (c) 2014 Dmitry Semenov; */
|
4
|
+
/**
|
5
|
+
*
|
6
|
+
* UI on top of main sliding area (caption, arrows, close button, etc.).
|
7
|
+
* Built just using public methods/properties of PhotoSwipe.
|
8
|
+
*
|
9
|
+
*/
|
10
|
+
(function (root, factory) {
|
11
|
+
if (typeof define === 'function' && define.amd) {
|
12
|
+
define(factory);
|
13
|
+
} else if (typeof exports === 'object') {
|
14
|
+
module.exports = factory;
|
15
|
+
} else {
|
16
|
+
root.PhotoSwipeUI_Default = factory();
|
17
|
+
}
|
18
|
+
})(this, function () {
|
19
|
+
|
20
|
+
'use strict';
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
var PhotoSwipeUI_Default =
|
25
|
+
function(pswp, framework) {
|
26
|
+
var ui = this;
|
27
|
+
var _overlayUIUpdated = false,
|
28
|
+
_controlsVisible = true,
|
29
|
+
_fullscrenAPI,
|
30
|
+
_controls,
|
31
|
+
_captionContainer,
|
32
|
+
_fakeCaptionContainer,
|
33
|
+
_indexIndicator,
|
34
|
+
_shareButton,
|
35
|
+
_shareModal,
|
36
|
+
_shareModalHidden = true,
|
37
|
+
_initalCloseOnScrollValue,
|
38
|
+
_isIdle,
|
39
|
+
|
40
|
+
_loadingIndicator,
|
41
|
+
_loadingIndicatorHidden,
|
42
|
+
_loadingIndicatorTimeout,
|
43
|
+
|
44
|
+
_options = {
|
45
|
+
barsSize: {top:44, bottom:'auto'},
|
46
|
+
closeElClasses: ['item', 'caption', 'zoom-wrap', 'ui', 'top-bar'],
|
47
|
+
timeToIdle: 4000,
|
48
|
+
timeToIdleOutside: 1000,
|
49
|
+
loadingIndicatorDelay: 1000, // 2s
|
50
|
+
|
51
|
+
addCaptionHTMLFn: function(item, captionEl, isFake) {
|
52
|
+
if(!item.title) {
|
53
|
+
captionEl.children[0].innerHTML = '';
|
54
|
+
return false;
|
55
|
+
}
|
56
|
+
captionEl.children[0].innerHTML = item.title;
|
57
|
+
return true;
|
58
|
+
},
|
59
|
+
|
60
|
+
closeEl:true,
|
61
|
+
captionEl: true,
|
62
|
+
fullscreenEl: true,
|
63
|
+
zoomEl: true,
|
64
|
+
shareEl: true,
|
65
|
+
counterEl: true,
|
66
|
+
arrowEl: true,
|
67
|
+
preloaderEl: true,
|
68
|
+
|
69
|
+
tapToClose: false,
|
70
|
+
tapToToggleControls: true,
|
71
|
+
|
72
|
+
shareButtons: [
|
73
|
+
{id:'facebook', label:'Share on Facebook', url:'https://www.facebook.com/sharer/sharer.php?u={{url}}'},
|
74
|
+
{id:'twitter', label:'Tweet', url:'https://twitter.com/intent/tweet?text={{text}}&url={{url}}'},
|
75
|
+
{id:'pinterest', label:'Pin it', url:'http://www.pinterest.com/pin/create/button/?url={{url}}&media={{image_url}}&description={{text}}'},
|
76
|
+
{id:'download', label:'Download image', url:'{{raw_image_url}}', download:true}
|
77
|
+
],
|
78
|
+
indexIndicatorSep: ' / '
|
79
|
+
|
80
|
+
},
|
81
|
+
_blockControlsTap,
|
82
|
+
_blockControlsTapTimeout;
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
var _onControlsTap = function(e) {
|
88
|
+
|
89
|
+
|
90
|
+
if(_blockControlsTap) {
|
91
|
+
return true;
|
92
|
+
}
|
93
|
+
|
94
|
+
|
95
|
+
e = e || window.event;
|
96
|
+
|
97
|
+
|
98
|
+
var target = e.target || e.srcElement,
|
99
|
+
uiElement,
|
100
|
+
clickedClass = target.className,
|
101
|
+
found;
|
102
|
+
|
103
|
+
for(var i = 0; i < _uiElements.length; i++) {
|
104
|
+
uiElement = _uiElements[i];
|
105
|
+
if(uiElement.onTap && clickedClass.indexOf('pswp__' + uiElement.name ) > -1 ) {
|
106
|
+
uiElement.onTap();
|
107
|
+
found = true;
|
108
|
+
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
if(found) {
|
113
|
+
if(e.stopPropagation) {
|
114
|
+
e.stopPropagation();
|
115
|
+
}
|
116
|
+
_blockControlsTap = true;
|
117
|
+
_blockControlsTapTimeout = setTimeout(function() {
|
118
|
+
_blockControlsTap = false;
|
119
|
+
}, 30 );
|
120
|
+
}
|
121
|
+
|
122
|
+
},
|
123
|
+
_fitControlsInViewport = function() {
|
124
|
+
return !pswp.likelyTouchDevice || pswp.options.mouseUsed || screen.width > 1200;
|
125
|
+
},
|
126
|
+
_toggleShareModal = function() {
|
127
|
+
|
128
|
+
_shareModalHidden = !_shareModalHidden;
|
129
|
+
|
130
|
+
|
131
|
+
if(!_shareModalHidden) {
|
132
|
+
framework[ (_shareModalHidden ? 'add' : 'remove') + 'Class'](_shareModal, 'pswp__share-modal--hidden');
|
133
|
+
setTimeout(function() {
|
134
|
+
if(!_shareModalHidden) {
|
135
|
+
framework.addClass(_shareModal, 'pswp__share-modal--fade-in');
|
136
|
+
}
|
137
|
+
}, 30);
|
138
|
+
} else {
|
139
|
+
framework.removeClass(_shareModal, 'pswp__share-modal--fade-in');
|
140
|
+
setTimeout(function() {
|
141
|
+
if(_shareModalHidden) {
|
142
|
+
framework[ (_shareModalHidden ? 'add' : 'remove') + 'Class'](_shareModal, 'pswp__share-modal--hidden');
|
143
|
+
}
|
144
|
+
}, 300);
|
145
|
+
}
|
146
|
+
|
147
|
+
if(!_shareModalHidden) {
|
148
|
+
_updateShareURLs();
|
149
|
+
}
|
150
|
+
return false;
|
151
|
+
},
|
152
|
+
_openWindowPopup = function(e) {
|
153
|
+
e = e || window.event;
|
154
|
+
var target = e.target || e.srcElement;
|
155
|
+
|
156
|
+
if(!target.href) {
|
157
|
+
return false;
|
158
|
+
}
|
159
|
+
|
160
|
+
if( target.hasAttribute('download') ) {
|
161
|
+
return true;
|
162
|
+
}
|
163
|
+
|
164
|
+
//if( !pswp.options.mouseUsed ) {
|
165
|
+
// target.setAttribute('target', '_self');
|
166
|
+
// return true;
|
167
|
+
//}
|
168
|
+
|
169
|
+
window.open(target.href, "pswp_share", "scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,top=100,left=" + (window.screen ? Math.round(screen.width / 2 - 275) : 100) );
|
170
|
+
if(!_shareModalHidden) {
|
171
|
+
_toggleShareModal();
|
172
|
+
}
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
return false;
|
177
|
+
},
|
178
|
+
_updateShareURLs = function() {
|
179
|
+
var shareButtonOut = '',
|
180
|
+
shareButtonData,
|
181
|
+
shareURL;
|
182
|
+
|
183
|
+
for(var i = 0; i < pswp.options.shareButtons.length; i++) {
|
184
|
+
shareButtonData = pswp.options.shareButtons[i];
|
185
|
+
|
186
|
+
shareURL = shareButtonData.url.replace('{{url}}', encodeURIComponent(window.location.href) )
|
187
|
+
.replace('{{image_url}}', encodeURIComponent(pswp.currItem.src || '') )
|
188
|
+
.replace('{{raw_image_url}}', pswp.currItem.src || '' )
|
189
|
+
.replace('{{text}}', encodeURIComponent(pswp.currItem.title || '') );
|
190
|
+
|
191
|
+
shareButtonOut += '<a href="' + shareURL + '" target="_blank" class="pswp__share--' + shareButtonData.id + '"' + (shareButtonData.download ? 'download' : '') + '>' + shareButtonData.label + '</a>';
|
192
|
+
}
|
193
|
+
_shareModal.children[0].innerHTML = shareButtonOut;
|
194
|
+
_shareModal.children[0].onclick = _openWindowPopup;
|
195
|
+
|
196
|
+
},
|
197
|
+
_hasCloseClass = function(target) {
|
198
|
+
for(var i = 0; i < pswp.options.closeElClasses.length; i++) {
|
199
|
+
if( framework.hasClass(target, 'pswp__' + pswp.options.closeElClasses[i]) ) {
|
200
|
+
return true;
|
201
|
+
}
|
202
|
+
}
|
203
|
+
},
|
204
|
+
_idleInterval,
|
205
|
+
_idleTimer,
|
206
|
+
_idleIncrement = 0,
|
207
|
+
_onIdleMouseMove = function() {
|
208
|
+
clearTimeout(_idleTimer);
|
209
|
+
_idleIncrement = 0;
|
210
|
+
if(_isIdle) {
|
211
|
+
ui.setIdle(false);
|
212
|
+
}
|
213
|
+
},
|
214
|
+
_onMouseLeaveWindow = function(e) {
|
215
|
+
e = e ? e : window.event;
|
216
|
+
var from = e.relatedTarget || e.toElement;
|
217
|
+
if (!from || from.nodeName == "HTML") {
|
218
|
+
clearTimeout(_idleTimer);
|
219
|
+
_idleTimer = setTimeout(function() {
|
220
|
+
ui.setIdle(true);
|
221
|
+
}, pswp.options.timeToIdleOutside);
|
222
|
+
}
|
223
|
+
},
|
224
|
+
_toggleLoadingIndicator = function(hide) {
|
225
|
+
|
226
|
+
if( /*pswp.likelyTouchDevice*/ _loadingIndicatorHidden !== hide ) {
|
227
|
+
framework[ (hide ? 'remove' : 'add') + 'Class' ](_loadingIndicator, 'pswp__preloader--active');
|
228
|
+
_loadingIndicatorHidden = hide;
|
229
|
+
}
|
230
|
+
};
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
var _uiElements = [
|
235
|
+
{
|
236
|
+
name: 'caption',
|
237
|
+
option: 'captionEl',
|
238
|
+
onInit: function(el) {
|
239
|
+
_captionContainer = el;
|
240
|
+
}
|
241
|
+
},
|
242
|
+
{
|
243
|
+
name: 'share-modal',
|
244
|
+
option: 'shareEl',
|
245
|
+
onInit: function(el) {
|
246
|
+
_shareModal = el;
|
247
|
+
},
|
248
|
+
onTap: function() {
|
249
|
+
_toggleShareModal();
|
250
|
+
}
|
251
|
+
},
|
252
|
+
{
|
253
|
+
name: 'button--share',
|
254
|
+
option: 'shareEl',
|
255
|
+
onInit: function(el) {
|
256
|
+
_shareButton = el;
|
257
|
+
},
|
258
|
+
onTap: function() {
|
259
|
+
_toggleShareModal();
|
260
|
+
}
|
261
|
+
},
|
262
|
+
{
|
263
|
+
name: 'button--zoom',
|
264
|
+
option: 'zoomEl',
|
265
|
+
onTap: pswp.toggleDesktopZoom
|
266
|
+
},
|
267
|
+
{
|
268
|
+
name: 'counter',
|
269
|
+
option: 'counterEl',
|
270
|
+
onInit: function(el) {
|
271
|
+
_indexIndicator = el;
|
272
|
+
}
|
273
|
+
},
|
274
|
+
{
|
275
|
+
name: 'button--close',
|
276
|
+
option: 'closeEl',
|
277
|
+
onTap: pswp.close
|
278
|
+
},
|
279
|
+
{
|
280
|
+
name: 'button--arrow--left',
|
281
|
+
option: 'arrowEl',
|
282
|
+
onTap: pswp.prev
|
283
|
+
},
|
284
|
+
{
|
285
|
+
name: 'button--arrow--right',
|
286
|
+
option: 'arrowEl',
|
287
|
+
onTap: pswp.next
|
288
|
+
},
|
289
|
+
{
|
290
|
+
name: 'button--fs',
|
291
|
+
option: 'fullscreenEl',
|
292
|
+
onTap: function() {
|
293
|
+
if(_fullscrenAPI.isFullscreen()) {
|
294
|
+
_fullscrenAPI.exit();
|
295
|
+
} else {
|
296
|
+
_fullscrenAPI.enter();
|
297
|
+
}
|
298
|
+
}
|
299
|
+
},
|
300
|
+
{
|
301
|
+
name: 'preloader',
|
302
|
+
option: 'preloaderEl',
|
303
|
+
onInit: function(el) {
|
304
|
+
_loadingIndicator = el;
|
305
|
+
}
|
306
|
+
}
|
307
|
+
|
308
|
+
];
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
ui.init = function() {
|
315
|
+
//return;
|
316
|
+
|
317
|
+
|
318
|
+
//window.pswp = pswp;
|
319
|
+
|
320
|
+
framework.extend(pswp.options, _options, true);
|
321
|
+
_controls = pswp.scrollWrap.children[1];//pswp.template.children[2];
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
var _listen = pswp.listen;
|
326
|
+
|
327
|
+
|
328
|
+
// Hide controls on vertical drag
|
329
|
+
_listen('onVerticalDrag', function(now) {
|
330
|
+
|
331
|
+
if(_controlsVisible && now < 0.95) {
|
332
|
+
ui.hideControls();
|
333
|
+
} else if(!_controlsVisible && now >= 0.95) {
|
334
|
+
ui.showControls();
|
335
|
+
}
|
336
|
+
|
337
|
+
});
|
338
|
+
|
339
|
+
// Hide controls when pinching to close
|
340
|
+
var pinchControlsHidden;
|
341
|
+
_listen('onPinchClose' , function(now) {
|
342
|
+
if(_controlsVisible && now < 0.9) {
|
343
|
+
ui.hideControls();
|
344
|
+
pinchControlsHidden = true;
|
345
|
+
} else if(pinchControlsHidden && !_controlsVisible && now > 0.9) {
|
346
|
+
ui.showControls();
|
347
|
+
}
|
348
|
+
});
|
349
|
+
_listen('zoomGestureEnded', function() {
|
350
|
+
pinchControlsHidden = false;
|
351
|
+
if(pinchControlsHidden && !_controlsVisible) {
|
352
|
+
ui.showControls();
|
353
|
+
}
|
354
|
+
|
355
|
+
});
|
356
|
+
|
357
|
+
_listen('beforeChange', ui.update);
|
358
|
+
|
359
|
+
|
360
|
+
//
|
361
|
+
// _listen('zoomGestureStarted', function() {
|
362
|
+
|
363
|
+
// if(pswp.options.tapToToggleControls ) {
|
364
|
+
// ui.hideControls();
|
365
|
+
// }
|
366
|
+
|
367
|
+
// });
|
368
|
+
|
369
|
+
// _listen('zoomGestureEnded', function() {
|
370
|
+
|
371
|
+
// if(pswp.options.tapToToggleControls && pswp.getZoomLevel() <= pswp.currItem.fitRatio ) {
|
372
|
+
// ui.showControls();
|
373
|
+
// }
|
374
|
+
|
375
|
+
// });
|
376
|
+
|
377
|
+
_listen('doubleTap', function(point) {
|
378
|
+
|
379
|
+
//pswp.toggleDesktopZoom(point);
|
380
|
+
// toggleDesktopZoom
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
var initialZoomLevel = pswp.currItem.initialZoomLevel;
|
385
|
+
if(pswp.getZoomLevel() !== initialZoomLevel) {
|
386
|
+
pswp.zoomTo(initialZoomLevel, point, 333);
|
387
|
+
} else {
|
388
|
+
pswp.zoomTo(pswp.currItem.doubleTapZoom, point, 333);
|
389
|
+
}
|
390
|
+
});
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
_listen('bindEvents', function() {
|
398
|
+
framework.bind(_controls, 'pswpTap click', _onControlsTap);
|
399
|
+
framework.bind(pswp.scrollWrap, 'pswpTap', ui.onGlobalTap);
|
400
|
+
|
401
|
+
if(!pswp.likelyTouchDevice) {
|
402
|
+
framework.bind(pswp.scrollWrap, 'mouseover', ui.onMouseOver);
|
403
|
+
}
|
404
|
+
|
405
|
+
|
406
|
+
});
|
407
|
+
|
408
|
+
|
409
|
+
if(pswp.options.timeToIdle) {
|
410
|
+
_listen('mouseUsed', function() {
|
411
|
+
|
412
|
+
framework.bind(document, 'mousemove', _onIdleMouseMove);
|
413
|
+
framework.bind(document, 'mouseout', _onMouseLeaveWindow);
|
414
|
+
|
415
|
+
_idleInterval = setInterval(function() {
|
416
|
+
_idleIncrement++;
|
417
|
+
if(_idleIncrement === 2) {
|
418
|
+
ui.setIdle(true);
|
419
|
+
}
|
420
|
+
}, pswp.options.timeToIdle / 2);
|
421
|
+
});
|
422
|
+
}
|
423
|
+
|
424
|
+
|
425
|
+
|
426
|
+
_listen('preventDragEvent', function(e, isDown, preventObj) {
|
427
|
+
var t = e.target || e.srcElement;
|
428
|
+
if(t && t.className && e.type.indexOf('mouse') > -1 && ( t.className.indexOf('__caption') > 0 || (/(SMALL|STRONG|EM)/i).test(t.tagName) ) ) {
|
429
|
+
preventObj.prevent = false;
|
430
|
+
}
|
431
|
+
});
|
432
|
+
|
433
|
+
|
434
|
+
_listen('unbindEvents', function() {
|
435
|
+
if(!_shareModalHidden) {
|
436
|
+
_toggleShareModal();
|
437
|
+
}
|
438
|
+
|
439
|
+
if(_idleInterval) {
|
440
|
+
clearInterval(_idleInterval);
|
441
|
+
}
|
442
|
+
framework.unbind(document, 'mouseout', _onMouseLeaveWindow);
|
443
|
+
framework.unbind(document, 'mousemove', _onIdleMouseMove);
|
444
|
+
framework.unbind(_controls, 'pswpTap click', _onControlsTap);
|
445
|
+
framework.unbind(pswp.scrollWrap, 'pswpTap', ui.onGlobalTap);
|
446
|
+
framework.unbind(pswp.scrollWrap, 'mouseover', ui.onMouseOver);
|
447
|
+
|
448
|
+
if(_fullscrenAPI) {
|
449
|
+
framework.unbind(document, _fullscrenAPI.eventK, ui.updateFullscreen);
|
450
|
+
if(_fullscrenAPI.isFullscreen()) {
|
451
|
+
_options.hideAnimationDuration = 0;
|
452
|
+
_fullscrenAPI.exit();
|
453
|
+
}
|
454
|
+
_fullscrenAPI = null;
|
455
|
+
}
|
456
|
+
});
|
457
|
+
|
458
|
+
|
459
|
+
_listen('destroy', function() {
|
460
|
+
|
461
|
+
|
462
|
+
if(pswp.options.captionEl) {
|
463
|
+
if(_fakeCaptionContainer) {
|
464
|
+
_controls.removeChild(_fakeCaptionContainer);
|
465
|
+
}
|
466
|
+
|
467
|
+
framework.removeClass(_captionContainer, 'pswp__caption--empty');
|
468
|
+
}
|
469
|
+
|
470
|
+
|
471
|
+
if(_shareModal) {
|
472
|
+
_shareModal.children[0].onclick = null;
|
473
|
+
}
|
474
|
+
framework.removeClass(_controls, 'pswp__ui--over-close');
|
475
|
+
framework.addClass( _controls, 'pswp__ui--hidden');
|
476
|
+
ui.setIdle(false);
|
477
|
+
|
478
|
+
});
|
479
|
+
|
480
|
+
|
481
|
+
if(!pswp.options.showAnimationDuration) {
|
482
|
+
framework.removeClass( _controls, 'pswp__ui--hidden');
|
483
|
+
}
|
484
|
+
_listen('initialZoomIn', function() {
|
485
|
+
if(pswp.options.showAnimationDuration) {
|
486
|
+
framework.removeClass( _controls, 'pswp__ui--hidden');
|
487
|
+
}
|
488
|
+
});
|
489
|
+
_listen('initialZoomOut', function() {
|
490
|
+
framework.addClass( _controls, 'pswp__ui--hidden');
|
491
|
+
});
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
_listen('parseVerticalMargin', function(item) {
|
496
|
+
var gap = item.vGap;
|
497
|
+
// if(pswp.options.customGap) {
|
498
|
+
// gap.top = pswp.options.customGap.top;
|
499
|
+
// gap.bottom = pswp.options.customGap.bottom;
|
500
|
+
// return;
|
501
|
+
// }
|
502
|
+
if( _fitControlsInViewport() /* !pswp.likelyTouchDevice || pswp.options.mouseUsed || screen.width > 1200 */ /* pswp.viewportSize.y > 800 */) {
|
503
|
+
|
504
|
+
var bars = pswp.options.barsSize;
|
505
|
+
if(pswp.options.captionEl && bars.bottom === 'auto') {
|
506
|
+
if(!_fakeCaptionContainer) {
|
507
|
+
_fakeCaptionContainer = framework.createEl('pswp__caption pswp__caption--fake');
|
508
|
+
_fakeCaptionContainer.appendChild( framework.createEl('pswp__caption__center') );
|
509
|
+
_controls.insertBefore(_fakeCaptionContainer, _captionContainer);
|
510
|
+
framework.addClass(_controls, 'pswp__ui--fit');
|
511
|
+
}
|
512
|
+
if( pswp.options.addCaptionHTMLFn(item, _fakeCaptionContainer, true) ) {
|
513
|
+
|
514
|
+
var captionSize = _fakeCaptionContainer.clientHeight;
|
515
|
+
gap.bottom = parseInt(captionSize,10) || 44;
|
516
|
+
} else {
|
517
|
+
gap.bottom = bars.top; // if no caption, set size of bottom gap to size of top
|
518
|
+
}
|
519
|
+
} else {
|
520
|
+
gap.bottom = bars.bottom;
|
521
|
+
}
|
522
|
+
|
523
|
+
// height of top bar is static, no need to calculate it
|
524
|
+
gap.top = bars.top;
|
525
|
+
} else {
|
526
|
+
gap.top = gap.bottom = 0;
|
527
|
+
}
|
528
|
+
});
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
var item,
|
533
|
+
classAttr,
|
534
|
+
uiElement;
|
535
|
+
|
536
|
+
|
537
|
+
|
538
|
+
var loopThroughChildElements = function(sChildren) {
|
539
|
+
var l = sChildren.length;
|
540
|
+
for(var i = 0; i < l; i++) {
|
541
|
+
item = sChildren[i];
|
542
|
+
classAttr = item.className;
|
543
|
+
|
544
|
+
for(var a = 0; a < _uiElements.length; a++) {
|
545
|
+
uiElement = _uiElements[a];
|
546
|
+
|
547
|
+
|
548
|
+
if(classAttr.indexOf('pswp__' + uiElement.name) > -1 ) {
|
549
|
+
|
550
|
+
if( pswp.options[uiElement.option] ) { // if element is not disabled from options
|
551
|
+
|
552
|
+
framework.removeClass(item, 'pswp__element--disabled');
|
553
|
+
if(uiElement.onInit) {
|
554
|
+
uiElement.onInit(item);
|
555
|
+
}
|
556
|
+
|
557
|
+
//item.style.display = 'block';
|
558
|
+
} else {
|
559
|
+
framework.addClass(item, 'pswp__element--disabled');
|
560
|
+
//item.style.display = 'none';
|
561
|
+
}
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
}
|
566
|
+
}
|
567
|
+
}
|
568
|
+
};
|
569
|
+
loopThroughChildElements(_controls.children);
|
570
|
+
loopThroughChildElements(_controls.children[0].children);
|
571
|
+
|
572
|
+
|
573
|
+
if(pswp.options.shareEl && _shareButton && _shareModal) {
|
574
|
+
_shareModalHidden = true;
|
575
|
+
}
|
576
|
+
|
577
|
+
|
578
|
+
if(pswp.options.fullscreenEl) {
|
579
|
+
if(!_fullscrenAPI) {
|
580
|
+
_fullscrenAPI = ui.getFullscreenAPI();
|
581
|
+
}
|
582
|
+
if(_fullscrenAPI) {
|
583
|
+
framework.bind(document, _fullscrenAPI.eventK, ui.updateFullscreen);
|
584
|
+
ui.updateFullscreen();
|
585
|
+
framework.addClass(pswp.template, 'pswp--supports-fs');
|
586
|
+
} else {
|
587
|
+
framework.removeClass(pswp.template, 'pswp--supports-fs');
|
588
|
+
}
|
589
|
+
}
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
|
594
|
+
// Setup loading indicator
|
595
|
+
if(pswp.options.preloaderEl) {
|
596
|
+
|
597
|
+
_toggleLoadingIndicator(true);
|
598
|
+
|
599
|
+
_listen('beforeChange', function() {
|
600
|
+
|
601
|
+
clearTimeout(_loadingIndicatorTimeout);
|
602
|
+
|
603
|
+
// display loading indicator with delay
|
604
|
+
_loadingIndicatorTimeout = setTimeout(function() {
|
605
|
+
|
606
|
+
if(pswp.currItem && pswp.currItem.loading) {
|
607
|
+
|
608
|
+
if( !pswp.allowProgressiveImg() || (pswp.currItem.img && !pswp.currItem.img.naturalWidth) ) {
|
609
|
+
_toggleLoadingIndicator(false); // show preloader if progressive loading is not enabled, or image width is not defined yet (because of slow connection)
|
610
|
+
// items-controller.js function allowProgressiveImg
|
611
|
+
}
|
612
|
+
|
613
|
+
} else {
|
614
|
+
_toggleLoadingIndicator(true); // hide preloader
|
615
|
+
}
|
616
|
+
|
617
|
+
}, pswp.options.loadingIndicatorDelay);
|
618
|
+
|
619
|
+
});
|
620
|
+
_listen('imageLoadComplete', function(index, item) {
|
621
|
+
if(pswp.currItem === item) {
|
622
|
+
_toggleLoadingIndicator(true);
|
623
|
+
}
|
624
|
+
});
|
625
|
+
|
626
|
+
}
|
627
|
+
|
628
|
+
|
629
|
+
|
630
|
+
|
631
|
+
|
632
|
+
};
|
633
|
+
|
634
|
+
ui.setIdle = function(isIdle) {
|
635
|
+
_isIdle = isIdle;
|
636
|
+
framework[ (isIdle ? 'add' : 'remove') + 'Class' ](_controls, 'pswp__ui--idle');
|
637
|
+
};
|
638
|
+
|
639
|
+
ui.update = function() {
|
640
|
+
// Don't update UI if it's hidden
|
641
|
+
if(_controlsVisible && pswp.currItem) {
|
642
|
+
|
643
|
+
|
644
|
+
ui.updateIndexIndicator();
|
645
|
+
|
646
|
+
if(pswp.options.captionEl) {
|
647
|
+
pswp.options.addCaptionHTMLFn(pswp.currItem, _captionContainer);
|
648
|
+
|
649
|
+
if(!pswp.currItem.title) {
|
650
|
+
framework.addClass(_captionContainer, 'pswp__caption--empty');
|
651
|
+
} else {
|
652
|
+
framework.removeClass(_captionContainer, 'pswp__caption--empty');
|
653
|
+
}
|
654
|
+
}
|
655
|
+
|
656
|
+
_overlayUIUpdated = true;
|
657
|
+
|
658
|
+
|
659
|
+
} else {
|
660
|
+
_overlayUIUpdated = false;
|
661
|
+
}
|
662
|
+
};
|
663
|
+
ui.updateFullscreen = function() {
|
664
|
+
framework[ (_fullscrenAPI.isFullscreen() ? 'add' : 'remove') + 'Class' ](pswp.template, 'pswp--fs');
|
665
|
+
};
|
666
|
+
ui.updateIndexIndicator = function() {
|
667
|
+
if(pswp.options.counterEl) {
|
668
|
+
// +1, because human-friendly index starts from one.
|
669
|
+
_indexIndicator.innerHTML = (pswp.getCurrentIndex()+1) + pswp.options.indexIndicatorSep + pswp.options.getNumItemsFn();
|
670
|
+
}
|
671
|
+
|
672
|
+
};
|
673
|
+
|
674
|
+
ui.onGlobalTap = function(e) {
|
675
|
+
e = e || window.event;
|
676
|
+
var target = e.target || e.srcElement;
|
677
|
+
|
678
|
+
|
679
|
+
if(_blockControlsTap) {
|
680
|
+
return;
|
681
|
+
}
|
682
|
+
|
683
|
+
// if(e.detail.pointerType !== 'touch' && framework.hasClass(target, 'pswp__img') ) {
|
684
|
+
|
685
|
+
|
686
|
+
if(e.detail && e.detail.pointerType === 'mouse') {
|
687
|
+
|
688
|
+
// close gallery if clicked outside of the image
|
689
|
+
if(_hasCloseClass(target)) {
|
690
|
+
pswp.close();
|
691
|
+
}
|
692
|
+
|
693
|
+
if(framework.hasClass(target, 'pswp__img')) {
|
694
|
+
if(pswp.getZoomLevel() === 1 && pswp.getZoomLevel() <= pswp.currItem.fitRatio) {
|
695
|
+
pswp.close();
|
696
|
+
} else {
|
697
|
+
pswp.toggleDesktopZoom(e.detail.releasePoint);
|
698
|
+
}
|
699
|
+
}
|
700
|
+
|
701
|
+
} else {
|
702
|
+
|
703
|
+
// tap anywhere (except buttons) to toggle visibility of controls
|
704
|
+
|
705
|
+
if(pswp.options.tapToToggleControls) {
|
706
|
+
if(_controlsVisible) {
|
707
|
+
ui.hideControls();
|
708
|
+
} else {
|
709
|
+
ui.showControls();
|
710
|
+
}
|
711
|
+
}
|
712
|
+
|
713
|
+
// tap to close gallery
|
714
|
+
if(pswp.options.tapToClose && (framework.hasClass(target, 'pswp__img') || _hasCloseClass(target)) ) {
|
715
|
+
pswp.close();
|
716
|
+
return;
|
717
|
+
}
|
718
|
+
|
719
|
+
}
|
720
|
+
|
721
|
+
|
722
|
+
|
723
|
+
};
|
724
|
+
ui.onMouseOver = function(e) {
|
725
|
+
e = e || window.event;
|
726
|
+
var target = e.target || e.srcElement;
|
727
|
+
|
728
|
+
// apply class when mouse is over an element that should close the gallery
|
729
|
+
if(_hasCloseClass(target)) {
|
730
|
+
framework.addClass(_controls, 'pswp__ui--over-close');
|
731
|
+
} else {
|
732
|
+
framework.removeClass(_controls, 'pswp__ui--over-close');
|
733
|
+
}
|
734
|
+
|
735
|
+
// if(_overImage) {
|
736
|
+
|
737
|
+
// }
|
738
|
+
};
|
739
|
+
|
740
|
+
ui.hideControls = function() {
|
741
|
+
framework.addClass(_controls,'pswp__ui--hidden');
|
742
|
+
_controlsVisible = false;
|
743
|
+
};
|
744
|
+
|
745
|
+
ui.showControls = function() {
|
746
|
+
_controlsVisible = true;
|
747
|
+
if(!_overlayUIUpdated) {
|
748
|
+
ui.update();
|
749
|
+
}
|
750
|
+
framework.removeClass(_controls,'pswp__ui--hidden');
|
751
|
+
};
|
752
|
+
|
753
|
+
ui.supportsFullscreen = function() {
|
754
|
+
var d = document;
|
755
|
+
return !!(d.exitFullscreen || d.mozCancelFullScreen || d.webkitExitFullscreen || d.msExitFullscreen);
|
756
|
+
};
|
757
|
+
|
758
|
+
ui.getFullscreenAPI = function() {
|
759
|
+
var dE = document.documentElement,
|
760
|
+
api,
|
761
|
+
tF = 'fullscreenchange';
|
762
|
+
|
763
|
+
if (dE.requestFullscreen) {
|
764
|
+
api = {
|
765
|
+
enterK: 'requestFullscreen',
|
766
|
+
exitK: 'exitFullscreen',
|
767
|
+
elementK: 'fullscreenElement',
|
768
|
+
eventK: tF
|
769
|
+
};
|
770
|
+
|
771
|
+
} else if(dE.mozRequestFullScreen ) {
|
772
|
+
api = {
|
773
|
+
enterK: 'mozRequestFullScreen',
|
774
|
+
exitK: 'mozCancelFullScreen',
|
775
|
+
elementK: 'mozFullScreenElement',
|
776
|
+
eventK: 'moz' + tF
|
777
|
+
};
|
778
|
+
|
779
|
+
|
780
|
+
|
781
|
+
} else if(dE.webkitRequestFullscreen) {
|
782
|
+
api = {
|
783
|
+
enterK: 'webkitRequestFullscreen',
|
784
|
+
exitK: 'webkitExitFullscreen',
|
785
|
+
elementK: 'webkitFullscreenElement',
|
786
|
+
eventK: 'webkit' + tF
|
787
|
+
};
|
788
|
+
|
789
|
+
} else if(dE.msRequestFullscreen) {
|
790
|
+
api = {
|
791
|
+
enterK: 'msRequestFullscreen',
|
792
|
+
exitK: 'msExitFullscreen',
|
793
|
+
elementK: 'msFullscreenElement',
|
794
|
+
eventK: 'MSFullscreenChange'
|
795
|
+
};
|
796
|
+
}
|
797
|
+
|
798
|
+
if(api) {
|
799
|
+
api.enter = function() {
|
800
|
+
// disable close-on-scroll in fullscreen
|
801
|
+
_initalCloseOnScrollValue = pswp.options.closeOnScroll;
|
802
|
+
pswp.options.closeOnScroll = false;
|
803
|
+
|
804
|
+
return pswp.template[this.enterK]( Element.ALLOW_KEYBOARD_INPUT );
|
805
|
+
};
|
806
|
+
api.exit = function() {
|
807
|
+
pswp.options.closeOnScroll = _initalCloseOnScrollValue;
|
808
|
+
|
809
|
+
return document[this.exitK]();
|
810
|
+
|
811
|
+
};
|
812
|
+
api.isFullscreen = function() { return document[this.elementK]; };
|
813
|
+
}
|
814
|
+
|
815
|
+
return api;
|
816
|
+
};
|
817
|
+
|
818
|
+
|
819
|
+
|
820
|
+
};
|
821
|
+
return PhotoSwipeUI_Default;
|
822
|
+
|
823
|
+
|
824
|
+
});
|