snappymail/vendors/photoswipe/photoswipe-ui-default.min.js

4 lines
9.1 KiB
JavaScript
Raw Normal View History

/*! PhotoSwipe Default UI - 4.0.0 - 2014-12-04
* http://photoswipe.com
* Copyright (c) 2014 Dmitry Semenov; */
(function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t:e.PhotoSwipeUI_Default=t()})(this,function(){"use strict";var e=function(e,t){var n,o,i,a,r,l,s,u,c,d,p,m,f,h,v,y,x=this,w=!1,g=!0,b=!0,I={barsSize:{top:44,bottom:"auto"},closeElClasses:["item","caption","zoom-wrap","ui","top-bar"],timeToIdle:4e3,timeToIdleOutside:1e3,loadingIndicatorDelay:1e3,addCaptionHTMLFn:function(e,t){return e.title?(t.children[0].innerHTML=e.title,!0):(t.children[0].innerHTML="",!1)},closeEl:!0,captionEl:!0,fullscreenEl:!0,zoomEl:!0,shareEl:!0,counterEl:!0,arrowEl:!0,preloaderEl:!0,tapToClose:!1,tapToToggleControls:!0,shareButtons:[{id:"facebook",label:"Share on Facebook",url:"https://www.facebook.com/sharer/sharer.php?u={{url}}"},{id:"twitter",label:"Tweet",url:"https://twitter.com/intent/tweet?text={{text}}&url={{url}}"},{id:"pinterest",label:"Pin it",url:"http://www.pinterest.com/pin/create/button/?url={{url}}&media={{image_url}}&description={{text}}"},{id:"download",label:"Download image",url:"{{raw_image_url}}",download:!0}],indexIndicatorSep:" / "},C=function(e){if(f)return!0;e=e||window.event;for(var t,n,o=e.target||e.srcElement,i=o.className,a=0;Z.length>a;a++)t=Z[a],t.onTap&&i.indexOf("pswp__"+t.name)>-1&&(t.onTap(),n=!0);n&&(e.stopPropagation&&e.stopPropagation(),f=!0,h=setTimeout(function(){f=!1},30))},T=function(){return!e.likelyTouchDevice||e.options.mouseUsed||screen.width>1200},E=function(){return b=!b,b?(t.removeClass(s,"pswp__share-modal--fade-in"),setTimeout(function(){b&&t[(b?"add":"remove")+"Class"](s,"pswp__share-modal--hidden")},300)):(t[(b?"add":"remove")+"Class"](s,"pswp__share-modal--hidden"),setTimeout(function(){b||t.addClass(s,"pswp__share-modal--fade-in")},30)),b||D(),!1},_=function(e){e=e||window.event;var t=e.target||e.srcElement;return t.href?t.hasAttribute("download")?!0:(window.open(t.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)),b||E(),!1):!1},D=function(){for(var t,n,o="",i=0;e.options.shareButtons.length>i;i++)t=e.options.shareButtons[i],n=t.url.replace("{{url}}",encodeURIComponent(window.location.href)).replace("{{image_url}}",encodeURIComponent(e.currItem.src||"")).replace("{{raw_image_url}}",e.currItem.src||"").replace("{{text}}",encodeURIComponent(e.currItem.title||"")),o+='<a href="'+n+'" target="_blank" class="pswp__share--'+t.id+'"'+(t.download?"download":"")+">"+t.label+"</a>";s.children[0].innerHTML=o,s.children[0].onclick=_},k=function(n){for(var o=0;e.options.closeElClasses.length>o;o++)if(t.hasClass(n,"pswp__"+e.options.closeElClasses[o]))return!0},M=0,F=function(){clearTimeout(y),M=0,c&&x.setIdle(!1)},S=function(t){t=t?t:window.event;var n=t.relatedTarget||t.toElement;n&&"HTML"!=n.nodeName||(clearTimeout(y),y=setTimeout(function(){x.setIdle(!0)},e.options.timeToIdleOutside))},O=function(e){p!==e&&(t[(e?"remove":"add")+"Class"](d,"pswp__preloader--active"),p=e)},Z=[{name:"caption",option:"captionEl",onInit:function(e){i=e}},{name:"share-modal",option:"shareEl",onInit:function(e){s=e},onTap:function(){E()}},{name:"button--share",option:"shareEl",onInit:function(e){l=e},onTap:function(){E()}},{name:"button--zoom",option:"zoomEl",onTap:e.toggleDesktopZoom},{name:"counter",option:"counterEl",onInit:function(e){r=e}},{name:"button--close",option:"closeEl",onTap:e.close},{name:"button--arrow--left",option:"arrowEl",onTap:e.prev},{name:"button--arrow--right",option:"arrowEl",onTap:e.next},{name:"button--fs",option:"fullscreenEl",onTap:function(){n.isFullscreen()?n.exit():n.enter()}},{name:"preloader",option:"preloaderEl",onInit:function(e){d=e}}];x.init=function(){t.extend(e.options,I,!0),o=e.scrollWrap.children[1];var r=e.listen;r("onVerticalDrag",function(e){g&&.95>e?x.hideControls():!g&&e>=.95&&x.showControls()});var u;r("onPinchClose",function(e){g&&.9>e?(x.hideControls(),u=!0):u&&!g&&e>.9&&x.showControls()}),r("zoomGestureEnded",function(){u=!1,u&&!g&&x.showControls()}),r("beforeChange",x.update),r("doubleTap",function(t){var n=e.currI