snappymail/vendors/photoswipe/photoswipe.min.js

4 lines
28 KiB
JavaScript
Raw Normal View History

/*! PhotoSwipe - v4.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.PhotoSwipe=t()})(this,function(){"use strict";var e=function(e,t,n,i){var o={features:null,bind:function(e,t,n,i){var o=(i?"remove":"add")+"EventListener";t=t.split(" ");for(var a=0;t.length>a;a++)t[a]&&e[o](t[a],n,!1)},isArray:function(e){return e instanceof Array},createEl:function(e,t){var n=document.createElement(t||"div");return e&&(n.className=e),n},getScrollY:function(){var e=window.pageYOffset;return void 0!==e?e:document.documentElement.scrollTop},unbind:function(e,t,n){o.bind(e,t,n,!0)},removeClass:function(e,t){var n=RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")},addClass:function(e,t){o.hasClass(e,t)||(e.className+=(e.className?" ":"")+t)},hasClass:function(e,t){return e.className&&RegExp("(^|\\s)"+t+"(\\s|$)").test(e.className)},arraySearch:function(e,t,n){for(var i=e.length;i--;)if(e[i][n]===t)return i;return-1},extend:function(e,t,n){for(var i in t)if(t.hasOwnProperty(i)){if(n&&e.hasOwnProperty(i))continue;e[i]=t[i]}},easing:{sine:{out:function(e){return Math.sin(e*(Math.PI/2))},inOut:function(e){return-(Math.cos(Math.PI*e)-1)/2}},cubic:{out:function(e){return--e*e*e+1}}},detectFeatures:function(){if(o.features)return o.features;var e=o.createEl(),t=e.style,n="",i={};if(i.oldIE=document.all&&!document.addEventListener,i.touch="ontouchstart"in window,window.requestAnimationFrame&&(i.raf=window.requestAnimationFrame,i.caf=window.cancelAnimationFrame),i.pointerEvent=navigator.pointerEnabled||navigator.msPointerEnabled,!i.pointerEvent){var a=navigator.userAgent;if(/iP(hone|od)/.test(navigator.platform)){var r=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);r=parseInt(r[1],10),r>=1&&8>r&&(i.isOldIOSPhone=!0)}var l=a.match(/Android\s([0-9\.]*)/),s=l?l[1]:0;s=parseFloat(s),s>=1&&4.4>s?i.isOldAndroid=!0:s>=5&&(i.isNewAndroid=!0),i.isMobileOpera=/opera mini|opera mobi/i.test(a)}for(var c,u,d=["transform","perspective","animationName"],m=["","webkit","Moz","ms","O"],p=0;4>p;p++){n=m[p];for(var f=0;3>f;f++)c=d[f],u=n+(n?c.charAt(0).toUpperCase()+c.slice(1):c),!i[c]&&u in t&&(i[c]=u);n&&!i.raf&&(n=n.toLowerCase(),i.raf=window[n+"RequestAnimationFrame"],i.raf&&(i.caf=window[n+"CancelAnimationFrame"]||window[n+"CancelRequestAnimationFrame"]))}if(!i.raf){var h=0;i.raf=function(e){var t=(new Date).getTime(),n=Math.max(0,16-(t-h)),i=window.setTimeout(function(){e(t+n)},n);return h=t+n,i},i.caf=function(e){clearTimeout(e)}}return i.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,o.features=i,i}};o.detectFeatures(),o.features.oldIE&&(o.bind=function(e,t,n,i){t=t.split(" ");for(var o,a=(i?"detach":"attach")+"Event",r=0;t.length>r;r++)if(o=t[r])if("object"==typeof n&&n.handleEvent){if(i){if(!n["oldIE"+o])return!1}else n["oldIE"+o]=function(){n.handleEvent.call(n)};e[a]("on"+o,n["oldIE"+o])}else e[a]("on"+o,n)});var a=this,r=25,l=3,s={allowPanToNext:!0,spacing:.12,bgOpacity:1,mouseUsed:!1,loop:!0,pinchToClose:!0,closeOnScroll:!0,closeOnVerticalDrag:!0,hideAnimationDuration:333,showAnimationDuration:333,showHideOpacity:!1,focus:!0,escKey:!0,arrowKeys:!0,mainScrollEndFriction:.35,panEndFriction:.35,scaleMode:"fit",modal:!0,alwaysFadeIn:!1};o.extend(s,i);var c,u,d,m,p,f,h,y,v,x,g,w,b,I,D,T,M,k,C,S,Z,A,O,E,R,F,P,L,z,N,_,U,H,Y,B,W,V,G,X,q,K,$,j,J,Q,et,tt,nt,it,ot,at,rt,lt,st,ct,ut,dt,mt,pt,ft,ht,yt,vt,xt=function(){return{x:0,y:0}},gt=0,wt=xt(),bt=xt(),It=xt(),Dt=xt(),Tt={},Mt=0,kt=0,Ct=xt(),St=0,Zt=!0,At=[],Ot={},Et=function(e,t){o.extend(a,t.publicMethods),At.push(e)},Rt=function(e){var t=yt();return e>t-1?e-t:0>e?t+e:e},Ft={},Pt=function(e,t){return Ft[e]||(Ft[e]=[]),Ft[e].push(t)},Lt=function(e){var t=Ft[e];if(t){var n=Array.prototype.slice.call(arguments);n.shift();for(var i=0;t.length>i;i++)t[i].apply(a,n)}},zt=function(){return(new Date).getTime()},Nt=function(e){ct=e,a.bg.style.opacity=e*s.bgOpacity},_t=function(e,t,n,i){e[A]=w+t+"px, "+n+"px"+b+" scale("+i+")"},Ut=function(){it&&_t(it,It.x