From 05602e52755cc69d1f530a64a65cc5b6b0b225b9 Mon Sep 17 00:00:00 2001 From: Minh Tran Date: Tue, 19 Jul 2016 17:35:15 +0700 Subject: [PATCH] Support id, className props --- README.md | 4 ++++ dist/react-photoswipe.js | 4 ++-- lib/PhotoSwipe.js | 20 ++++---------------- lib/PhotoSwipeGallery.js | 24 ++++++++++-------------- package.json | 3 ++- src/PhotoSwipe.js | 11 +++-------- src/PhotoSwipeGallery.js | 20 ++++++-------------- 7 files changed, 31 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index bbdc014..b0f7754 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,8 @@ imageLoadComplete(instance, index, item); | items | array | [] | true | http://photoswipe.com/documentation/getting-started.html | | options | object | {} | false | http://photoswipe.com/documentation/options.html | | onClose | function | | false | Callback after PhotoSwipe close | +| id | string | | false | | +| className | string | `pswp` | | | beforeChange | function | | false | Photoswipe event listener | | afterChange | function | | false | Photoswipe event listener | | imageLoadComplete | function | | false | Photoswipe event listener | @@ -159,6 +161,8 @@ imageLoadComplete(instance, index, item); | items | array | [] | true | http://photoswipe.com/documentation/getting-started.html | | options | object | {} | false | http://photoswipe.com/documentation/options.html | | thumbnailContent | function | `` | false | Thumbnail content | +| id | string | | false | | +| className | string | `pswp-gallery` | | | beforeChange | function | | false | Photoswipe event listener | | afterChange | function | | false | Photoswipe event listener | | imageLoadComplete | function | | false | Photoswipe event listener | diff --git a/dist/react-photoswipe.js b/dist/react-photoswipe.js index 4655105..2178486 100644 --- a/dist/react-photoswipe.js +++ b/dist/react-photoswipe.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports.ReactPhotoswipe=t(require("react"),require("react-dom")):e.ReactPhotoswipe=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}var i=n(1),r=o(i),a=n(8),l=o(a);e.exports={PhotoSwipe:r["default"],PhotoSwipeGallery:l["default"]}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t0&&(a=parseInt(a[1],10),a>=1&&a<8&&(o.isOldIOSPhone=!0))}var l=r.match(/Android\s([0-9\.]*)/),s=l?l[1]:0;s=parseFloat(s),s>=1&&(s<4.4&&(o.isOldAndroid=!0),o.androidVersion=s),o.isMobileOpera=/opera mini|opera mobi/i.test(r)}for(var u,c,p=["transform","perspective","animationName"],d=["","webkit","Moz","ms","O"],f=0;f<4;f++){n=d[f];for(var m=0;m<3;m++)u=p[m],c=n+(n?u.charAt(0).toUpperCase()+u.slice(1):u),!o[u]&&c in t&&(o[u]=c);n&&!o.raf&&(n=n.toLowerCase(),o.raf=window[n+"RequestAnimationFrame"],o.raf&&(o.caf=window[n+"CancelAnimationFrame"]||window[n+"CancelRequestAnimationFrame"]))}if(!o.raf){var h=0;o.raf=function(e){var t=(new Date).getTime(),n=Math.max(0,16-(t-h)),o=window.setTimeout(function(){e(t+n)},n);return h=t+n,o},o.caf=function(e){clearTimeout(e)}}return o.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,i.features=o,o}};i.detectFeatures(),i.features.oldIE&&(i.bind=function(e,t,n,o){t=t.split(" ");for(var i,r=(o?"detach":"attach")+"Event",a=function(){n.handleEvent.call(n)},l=0;lt-1?e-t:e<0?t+e:e},Te={},Oe=function(e,t){return Te[e]||(Te[e]=[]),Te[e].push(t)},Se=function(e){var t=Te[e];if(t){var n=Array.prototype.slice.call(arguments);n.shift();for(var o=0;or.currItem.fitRatio?Ce||(dn(r.currItem,!1,!0),Ce=!0):Ce&&(dn(r.currItem),Ce=!1)),Me(oe,me.x,me.y,w))},Fe=function(e){e.container&&Me(e.container.style,e.initialPosition.x,e.initialPosition.y,e.initialZoomLevel,e)},Ae=function(e,t){t[P]=x+e+"px, 0px"+b},Re=function(e,t){if(!s.loop&&t){var n=d+(we.x*ve-e)/we.x,o=Math.round(e-wt.x);(n<0&&o>0||n>=Qt()-1&&o<0)&&(e=wt.x+o*s.mainScrollEndFriction)}wt.x=e,Ae(e,f)},Ne=function(e,t){var n=gt[e]-ye[e];return fe[e]+de[e]+n-n*(t/g)},Le=function(e,t){e.x=t.x,e.y=t.y,t.id&&(e.id=t.id)},Ze=function(e){e.x=Math.round(e.x),e.y=Math.round(e.y)},ze=null,Ue=function(){ze&&(i.unbind(document,"mousemove",Ue),i.addClass(e,"pswp--has_mouse"),s.mouseUsed=!0,Se("mouseUsed")),ze=setTimeout(function(){ze=null},100)},Ke=function(){i.bind(document,"keydown",r),z.transform&&i.bind(r.scrollWrap,"click",r),s.mouseUsed||i.bind(document,"mousemove",Ue),i.bind(window,"resize scroll",r),Se("bindEvents")},je=function(){i.unbind(window,"resize",r),i.unbind(window,"scroll",y.scroll),i.unbind(document,"keydown",r),i.unbind(document,"mousemove",Ue),z.transform&&i.unbind(r.scrollWrap,"click",r),q&&i.unbind(window,h,r),Se("unbindEvents")},Be=function(e,t){var n=sn(r.currItem,he,e);return t&&(ne=n),n},He=function(e){return e||(e=r.currItem),e.initialZoomLevel},We=function(e){return e||(e=r.currItem),e.w>0?s.maxSpreadZoom:1},qe=function(e,t,n,o){return o===r.currItem.initialZoomLevel?(n[e]=r.currItem.initialPosition[e],!0):(n[e]=Ne(e,o),n[e]>t.min[e]?(n[e]=t.min[e],!0):n[e]1?1:e.fitRatio,n=e.container.style,o=t*e.w,i=t*e.h;n.width=o+"px",n.height=i+"px",n.left=e.initialPosition.x+"px",n.top=e.initialPosition.y+"px"},ke=function(){if(oe){var e=oe,t=r.currItem,n=t.fitRatio>1?1:t.fitRatio,o=n*t.w,i=n*t.h;e.width=o+"px",e.height=i+"px",e.left=me.x+"px",e.top=me.y+"px"}}},Ge=function(e){var t="";s.escKey&&27===e.keyCode?t="close":s.arrowKeys&&(37===e.keyCode?t="prev":39===e.keyCode&&(t="next")),t&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey||(e.preventDefault?e.preventDefault():e.returnValue=!1,r[t]()))},Ve=function(e){e&&(V||G||ie||H)&&(e.preventDefault(),e.stopPropagation())},Xe=function(){r.setScrollOffset(0,i.getScrollY())},$e={},Je=0,Qe=function(e){$e[e]&&($e[e].raf&&A($e[e].raf),Je--,delete $e[e])},et=function(e){$e[e]&&Qe(e),$e[e]||(Je++,$e[e]={})},tt=function(){for(var e in $e)$e.hasOwnProperty(e)&&Qe(e)},nt=function(e,t,n,o,i,r,a){var l,s=De();et(e);var u=function(){if($e[e]){if(l=De()-s,l>=o)return Qe(e),r(n),void(a&&a());r((n-t)*i(l/o)+t),$e[e].raf=F(u)}};u()},ot={shout:Se,listen:Oe,viewportSize:he,options:s,isMainScrollAnimating:function(){return ie},getZoomLevel:function(){return w},getCurrentIndex:function(){return d},isDragging:function(){return q},isZooming:function(){return Q},setScrollOffset:function(e,t){ye.x=e,Z=ye.y=t,Se("updateScrollOffset",ye)},applyZoomPan:function(e,t,n,o){me.x=t,me.y=n,w=e,ke(o)},init:function(){if(!u&&!c){var n;r.framework=i,r.template=e,r.bg=i.getChildByClass(e,"pswp__bg"),R=e.className,u=!0,z=i.detectFeatures(),F=z.raf,A=z.caf,P=z.transform,L=z.oldIE,r.scrollWrap=i.getChildByClass(e,"pswp__scroll-wrap"),r.container=i.getChildByClass(r.scrollWrap,"pswp__container"),f=r.container.style,r.itemHolders=E=[{el:r.container.children[0],wrap:0,index:-1},{el:r.container.children[1],wrap:0,index:-1},{el:r.container.children[2],wrap:0,index:-1}],E[0].el.style.display=E[2].el.style.display="none",Ye(),y={resize:r.updateSize,scroll:Xe,keydown:Ge,click:Ve};var o=z.isOldIOSPhone||z.isOldAndroid||z.isMobileOpera;for(z.animationName&&z.transform&&!o||(s.showAnimationDuration=s.hideAnimationDuration=0),n=0;n=Qt())&&(d=0),r.currItem=Jt(d),(z.isOldIOSPhone||z.isOldAndroid)&&(xe=!1),e.setAttribute("aria-hidden","false"),s.modal&&(xe?e.style.position="fixed":(e.style.position="absolute",e.style.top=i.getScrollY()+"px")),void 0===Z&&(Se("initialLayout"),Z=N=i.getScrollY());var p="pswp--open ";for(s.mainClass&&(p+=s.mainClass+" "),s.showHideOpacity&&(p+="pswp--animate_opacity "),p+=k?"pswp--touch":"pswp--notouch",p+=z.animationName?" pswp--css_animation":"",p+=z.svg?" pswp--svg":"",i.addClass(e,p),r.updateSize(),m=-1,ge=null,n=0;nne.min.x?e=ne.min.x:ene.min.y?t=ne.min.y:t=l&&(m+=ge+(ge>0?-l:l),n=l);for(var o=0;o0?(t=E.shift(),E[l-1]=t,m++,Ae((m+2)*we.x,t.el.style),r.setContent(t,d-n+o+1+1)):(t=E.pop(),E.unshift(t),m--,Ae(m*we.x,t.el.style),r.setContent(t,d+n-o-1-1));if(oe&&1===Math.abs(ge)){var i=Jt(I);i.initialZoomLevel!==w&&(sn(i,he),dn(i),Fe(i))}ge=0,r.updateCurrZoomItem(),I=d,Se("afterChange")}}},updateSize:function(t){if(!xe&&s.modal){var n=i.getScrollY();if(Z!==n&&(e.style.top=n+"px",Z=n),!t&&_e.x===window.innerWidth&&_e.y===window.innerHeight)return;_e.x=window.innerWidth,_e.y=window.innerHeight,e.style.height=_e.y+"px"}if(he.x=r.scrollWrap.clientWidth,he.y=r.scrollWrap.clientHeight,Xe(),we.x=he.x+Math.round(he.x*s.spacing),we.y=he.y,Re(we.x*ve),Se("beforeResize"),void 0!==m){for(var o,a,u,c=0;c2&&(u=Ie(u)),a=Jt(u),a&&(C||a.needsUpdate||!a.bounds)?(r.cleanSlide(a),r.setContent(o,u),1===c&&(r.currItem=a,r.updateCurrZoomItem(!0)),a.needsUpdate=!1):o.index===-1&&u>=0&&r.setContent(o,u),a&&a.container&&(sn(a,he),dn(a),Fe(a));C=!1}g=w=r.currItem.initialZoomLevel,ne=r.currItem.bounds,ne&&(me.x=ne.center.x,me.y=ne.center.y,ke(!0)),Se("resize")},zoomTo:function(e,t,n,o,r){t&&(g=w,gt.x=Math.abs(t.x)-me.x,gt.y=Math.abs(t.y)-me.y,Le(fe,me));var a=Be(e,!1),l={};qe("x",a,l,e),qe("y",a,l,e);var s=w,u={x:me.x,y:me.y};Ze(l);var c=function(t){1===t?(w=e,me.x=l.x,me.y=l.y):(w=(e-s)*t+s,me.x=(l.x-u.x)*t+u.x,me.y=(l.y-u.y)*t+u.y),r&&r(t),ke(1===t)};n?nt("customZoomTo",0,1,n,o||i.easing.sine.inOut,c):c(1)}},it=30,rt=10,at={},lt={},st={},ut={},ct={},pt=[],dt={},ft=[],mt={},ht=0,vt=pe(),yt=0,wt=pe(),gt=pe(),xt=pe(),bt=function(e,t){return e.x===t.x&&e.y===t.y},_t=function(e,t){return Math.abs(e.x-t.x)-1)&&(t(e)?e:Ot(e.parentNode,t)))},St={},Dt=function(e,t){return St.prevent=!Ot(e.target,s.isClickableElement),Se("preventDragEvent",e,t,St),St.prevent},Pt=function(e,t){return t.x=e.pageX,t.y=e.pageY,t.id=e.identifier,t},Mt=function(e,t,n){n.x=.5*(e.x+t.x),n.y=.5*(e.y+t.y)},kt=function(e,t,n){if(e-K>50){var o=ft.length>2?ft.shift():{};o.x=t,o.y=n,ft.push(o),K=e}},Ft=function(){var e=me.y-r.currItem.initialPosition.y;return 1-Math.abs(e/(he.y/2))},At={},Rt={},Nt=[],Lt=function(e){for(;Nt.length>0;)Nt.pop();return M?(ce=0,pt.forEach(function(e){0===ce?Nt[0]=e:1===ce&&(Nt[1]=e),ce++})):e.type.indexOf("touch")>-1?e.touches&&e.touches.length>0&&(Nt[0]=Pt(e.touches[0],At),e.touches.length>1&&(Nt[1]=Pt(e.touches[1],Rt))):(At.x=e.pageX,At.y=e.pageY,At.id="",Nt[0]=At),Nt},Zt=function(e,t){var n,o,i,a,l=0,u=me[e]+t[e],c=t[e]>0,p=wt.x+t.x,d=wt.x-dt.x;return n=u>ne.min[e]||une.min[e]&&(n=s.panEndFriction,l=ne.min[e]-u,o=ne.min[e]-fe[e]),(o<=0||d<0)&&Qt()>1?(a=p,d<0&&p>dt.x&&(a=dt.x)):ne.min.x!==ne.max.x&&(i=u)):(u0)&&Qt()>1?(a=p,d>0&&pr.currItem.fitRatio&&(me[e]+=t[e]*n)):(void 0!==a&&(Re(a,!0),$=a!==dt.x),ne.min.x!==ne.max.x&&(void 0!==i?me.x=i:$||(me.x+=t.x*n)),void 0!==a)},zt=function(e){if(!("mousedown"===e.type&&e.button>0)){if($t)return void e.preventDefault();if(!W||"mousedown"!==e.type){if(Dt(e,!0)&&e.preventDefault(),Se("pointerDown"),M){var t=i.arraySearch(pt,e.pointerId,"id");t<0&&(t=pt.length),pt[t]={x:e.pageX,y:e.pageY,id:e.pointerId}}var n=Lt(e),o=n.length;J=null,tt(),q&&1!==o||(q=ae=!0,i.bind(window,h,r),B=ue=le=H=$=V=Y=G=!1,re=null,Se("firstTouchStart",n),Le(fe,me),de.x=de.y=0,Le(ut,n[0]),Le(ct,ut),dt.x=we.x*ve,ft=[{x:ut.x,y:ut.y}],K=U=De(),Be(w,!0),Et(),It()),!Q&&o>1&&!ie&&!$&&(g=w,G=!1,Q=Y=!0,de.y=de.x=0,Le(fe,me),Le(at,n[0]),Le(lt,n[1]),Mt(at,lt,xt),gt.x=Math.abs(xt.x)-me.x,gt.y=Math.abs(xt.y)-me.y,ee=te=Ct(at,lt))}}},Ut=function(e){if(e.preventDefault(),M){var t=i.arraySearch(pt,e.pointerId,"id");if(t>-1){var n=pt[t];n.x=e.pageX,n.y=e.pageY}}if(q){var o=Lt(e);if(re||V||Q)J=o;else if(wt.x!==we.x*ve)re="h";else{var r=Math.abs(o[0].x-ut.x)-Math.abs(o[0].y-ut.y);Math.abs(r)>=rt&&(re=r>0?"h":"v",J=o)}}},Kt=function(){if(J){var e=J.length;if(0!==e)if(Le(at,J[0]),st.x=at.x-ut.x,st.y=at.y-ut.y,Q&&e>1){if(ut.x=at.x,ut.y=at.y,!st.x&&!st.y&&bt(J[1],lt))return;Le(lt,J[1]),G||(G=!0,Se("zoomGestureStarted"));var t=Ct(at,lt),n=qt(t);n>r.currItem.initialZoomLevel+r.currItem.initialZoomLevel/15&&(ue=!0);var o=1,i=He(),a=We();if(n1&&(o=1),n=i-o*(i/3);else n>a&&(o=(n-a)/(6*i),o>1&&(o=1),n=a+o*i);o<0&&(o=0),ee=t,Mt(at,lt,vt),de.x+=vt.x-xt.x,de.y+=vt.y-xt.y,Le(xt,vt),me.x=Ne("x",n),me.y=Ne("y",n),B=n>w,w=n,ke()}else{if(!re)return;if(ae&&(ae=!1,Math.abs(st.x)>=rt&&(st.x-=J[0].x-ct.x),Math.abs(st.y)>=rt&&(st.y-=J[0].y-ct.y)),ut.x=at.x,ut.y=at.y,0===st.x&&0===st.y)return;if("v"===re&&s.closeOnVerticalDrag&&!Tt()){de.y+=st.y,me.y+=st.y;var c=Ft();return H=!0,Se("onVerticalDrag",c),Pe(c),void ke()}kt(De(),at.x,at.y),V=!0,ne=r.currItem.bounds;var p=Zt("x",st);p||(Zt("y",st),Ze(me),ke())}}},jt=function(e){if(z.isOldAndroid){if(W&&"mouseup"===e.type)return;e.type.indexOf("touch")>-1&&(clearTimeout(W),W=setTimeout(function(){W=0},600))}Se("pointerUp"),Dt(e,!1)&&e.preventDefault();var t;if(M){var n=i.arraySearch(pt,e.pointerId,"id");if(n>-1)if(t=pt.splice(n,1)[0],navigator.pointerEnabled)t.type=e.pointerType||"mouse";else{var o={4:"mouse",2:"touch",3:"pen"};t.type=o[e.pointerType],t.type||(t.type=e.pointerType||"mouse")}}var a,l=Lt(e),u=l.length;if("mouseup"===e.type&&(u=0),2===u)return J=null,!0;1===u&&Le(ct,l[0]),0!==u||re||ie||(t||("mouseup"===e.type?t={x:e.pageX,y:e.pageY,type:"mouse"}:e.changedTouches&&e.changedTouches[0]&&(t={x:e.changedTouches[0].pageX,y:e.changedTouches[0].pageY,type:"touch"})),Se("touchRelease",e,t));var c=-1;if(0===u&&(q=!1,i.unbind(window,h,r),Et(),Q?c=0:yt!==-1&&(c=De()-yt)),yt=1===u?De():-1,a=c!==-1&&c<150?"zoom":"swipe",Q&&u<2&&(Q=!1,1===u&&(a="zoomPointerUp"),Se("zoomGestureEnded")),J=null,V||G||ie||H)if(tt(),j||(j=Bt()),j.calculateSwipeSpeed("x"),H){var p=Ft();if(pr.currItem.fitRatio&&Ht(j))}},Bt=function(){var e,t,n={lastFlickOffset:{},lastFlickDist:{},lastFlickSpeed:{},slowDownRatio:{},slowDownRatioReverse:{},speedDecelerationRatio:{},speedDecelerationRatioAbs:{},distanceOffset:{},backAnimDestination:{},backAnimStarted:{},calculateSwipeSpeed:function(o){ft.length>1?(e=De()-K+50,t=ft[ft.length-2][o]):(e=De()-U,t=ct[o]),n.lastFlickOffset[o]=ut[o]-t,n.lastFlickDist[o]=Math.abs(n.lastFlickOffset[o]),n.lastFlickDist[o]>20?n.lastFlickSpeed[o]=n.lastFlickOffset[o]/e:n.lastFlickSpeed[o]=0,Math.abs(n.lastFlickSpeed[o])<.1&&(n.lastFlickSpeed[o]=0),n.slowDownRatio[o]=.95,n.slowDownRatioReverse[o]=1-n.slowDownRatio[o],n.speedDecelerationRatio[o]=1},calculateOverBoundsAnimOffset:function(e,t){n.backAnimStarted[e]||(me[e]>ne.min[e]?n.backAnimDestination[e]=ne.min[e]:me[e]it&&(l||t.lastFlickOffset.x>20)?o=-1:a<-it&&(l||t.lastFlickOffset.x<-20)&&(o=1)}var u;o&&(d+=o,d<0?(d=s.loop?Qt()-1:0,u=!0):d>=Qt()&&(d=s.loop?0:Qt()-1,u=!0),u&&!s.loop||(ge+=o,ve-=o,n=!0));var c,p=we.x*ve,f=Math.abs(p-wt.x);return n||p>wt.x==t.lastFlickSpeed.x>0?(c=Math.abs(t.lastFlickSpeed.x)>0?f/Math.abs(t.lastFlickSpeed.x):333,c=Math.min(c,400),c=Math.max(c,250)):c=333,ht===d&&(n=!1),ie=!0,Se("mainScrollAnimStart"),nt("mainScroll",wt.x,p,c,i.easing.cubic.out,Re,function(){tt(),ie=!1,ht=-1,(n||ht!==d)&&r.updateCurrItem(),Se("mainScrollAnimComplete")}),n&&r.updateCurrItem(!0),n},qt=function(e){return 1/te*e*g},Yt=function(){var e=w,t=He(),n=We();wn&&(e=n);var o,a=1,l=se;return le&&!B&&!ue&&w1||navigator.msMaxTouchPoints>1),r.likelyTouchDevice=k,y[T]=zt,y[O]=Ut,y[S]=jt,D&&(y[D]=y[S]),z.touch&&(v+=" mousedown",h+=" mousemove mouseup",y.mousedown=y[T],y.mousemove=y[O],y.mouseup=y[S]),k||(s.allowPanToNext=!1)}}});var Gt,Vt,Xt,$t,Jt,Qt,en,tn=function(t,n,o,a){Gt&&clearTimeout(Gt),$t=!0,Xt=!0;var l;t.initialLayout?(l=t.initialLayout,t.initialLayout=null):l=s.getThumbBoundsFn&&s.getThumbBoundsFn(d);var u=o?s.hideAnimationDuration:s.showAnimationDuration,c=function(){Qe("initialZoom"),o?(r.template.removeAttribute("style"),r.bg.removeAttribute("style")):(Pe(1),n&&(n.style.display="block"),i.addClass(e,"pswp--animated-in"),Se("initialZoom"+(o?"OutEnd":"InEnd"))),a&&a(),$t=!1};if(!u||!l||void 0===l.x)return Se("initialZoom"+(o?"Out":"In")),w=t.initialZoomLevel,Le(me,t.initialPosition),ke(),e.style.opacity=o?0:1,Pe(1),void(u?setTimeout(function(){c()},u):c());var f=function(){var n=p,a=!r.currItem.src||r.currItem.loadError||s.showHideOpacity;t.miniImg&&(t.miniImg.style.webkitBackfaceVisibility="hidden"),o||(w=l.w/t.w,me.x=l.x,me.y=l.y-N,r[a?"template":"bg"].style.opacity=.001,ke()),et("initialZoom"),o&&!n&&i.removeClass(e,"pswp--animated-in"),a&&(o?i[(n?"remove":"add")+"Class"](e,"pswp--animate_opacity"):setTimeout(function(){i.addClass(e,"pswp--animate_opacity")},30)),Gt=setTimeout(function(){if(Se("initialZoom"+(o?"Out":"In")),o){var r=l.w/t.w,s={x:me.x,y:me.y},p=w,d=se,f=function(t){1===t?(w=r,me.x=l.x,me.y=l.y-Z):(w=(r-p)*t+p,me.x=(l.x-s.x)*t+s.x,me.y=(l.y-Z-s.y)*t+s.y),ke(),a?e.style.opacity=1-t:Pe(d-t*d)};n?nt("initialZoom",0,1,u,i.easing.cubic.out,f,c):(f(1),Gt=setTimeout(c,u+20))}else w=t.initialZoomLevel,Le(me,t.initialPosition),ke(),Pe(1),a?e.style.opacity=1:Pe(1),Gt=setTimeout(c,u+20)},o?25:90)};f()},nn={},on=[],rn={index:0,errorMsg:'
The image could not be loaded.
',forceProgressiveLoading:!1,preload:[1,1],getNumItemsFn:function(){return Vt.length}},an=function(){return{center:{x:0,y:0},max:{x:0,y:0},min:{x:0,y:0}}},ln=function(e,t,n){var o=e.bounds;o.center.x=Math.round((nn.x-t)/2),o.center.y=Math.round((nn.y-n)/2)+e.vGap.top,o.max.x=t>nn.x?Math.round(nn.x-t):o.center.x,o.max.y=n>nn.y?Math.round(nn.y-n)+e.vGap.top:o.center.y,o.min.x=t>nn.x?0:o.center.x,o.min.y=n>nn.y?e.vGap.top:o.center.y},sn=function(e,t,n){if(e.src&&!e.loadError){var o=!n;if(o&&(e.vGap||(e.vGap={top:0,bottom:0}),Se("parseVerticalMargin",e)),nn.x=t.x,nn.y=t.y-e.vGap.top-e.vGap.bottom,o){var i=nn.x/e.w,r=nn.y/e.h;e.fitRatio=i1&&(n=1),e.initialZoomLevel=n,e.bounds||(e.bounds=an())}if(!n)return;return ln(e,e.w*n,e.h*n),o&&n===e.initialZoomLevel&&(e.initialPosition=e.bounds.center),e.bounds}return e.w=e.h=0,e.initialZoomLevel=e.fitRatio=1,e.bounds=an(),e.initialPosition=e.bounds.center,e.bounds},un=function(e,t,n,o,i,a){t.loadError||o&&(t.imageAppended=!0,dn(t,o,t===r.currItem&&Ce),n.appendChild(o),a&&setTimeout(function(){t&&t.loaded&&t.placeholder&&(t.placeholder.style.display="none",t.placeholder=null)},500))},cn=function(e){e.loading=!0,e.loaded=!1;var t=e.img=i.createEl("pswp__img","img"),n=function(){e.loading=!1,e.loaded=!0,e.loadComplete?e.loadComplete(e):e.img=null,t.onload=t.onerror=null,t=null};return t.onload=n,t.onerror=function(){e.loadError=!0,n()},t.src=e.src,t},pn=function(e,t){if(e.src&&e.loadError&&e.container)return t&&(e.container.innerHTML=""),e.container.innerHTML=s.errorMsg.replace("%url%",e.src),!0},dn=function(e,t,n){if(e.src){t||(t=e.container.lastChild);var o=n?e.w:Math.round(e.w*e.fitRatio),i=n?e.h:Math.round(e.h*e.fitRatio);e.placeholder&&!e.loaded&&(e.placeholder.style.width=o+"px",e.placeholder.style.height=i+"px"),t.style.width=o+"px",t.style.height=i+"px"}},fn=function(){if(on.length){for(var e,t=0;t=0,i=Math.min(n[0],Qt()),a=Math.min(n[1],Qt());for(t=1;t<=(o?a:i);t++)r.lazyLoadItem(d+t);for(t=1;t<=(o?i:a);t++)r.lazyLoadItem(d-t)}),Oe("initialLayout",function(){r.currItem.initialLayout=s.getThumbBoundsFn&&s.getThumbBoundsFn(d)}),Oe("mainScrollAnimComplete",fn),Oe("initialZoomInEnd",fn),Oe("destroy",function(){for(var e,t=0;t=0&&(void 0!==Vt[e]&&Vt[e])},allowProgressiveImg:function(){return s.forceProgressiveLoading||!k||s.mouseUsed||screen.width>1200},setContent:function(e,t){s.loop&&(t=Ie(t));var n=r.getItemAt(e.index);n&&(n.container=null);var o,a=r.getItemAt(t);if(!a)return void(e.el.innerHTML="");Se("gettingData",t,a),e.index=t,e.item=a;var l=a.container=i.createEl("pswp__zoom-wrap");if(!a.src&&a.html&&(a.html.tagName?l.appendChild(a.html):l.innerHTML=a.html),pn(a),sn(a,he),!a.src||a.loadError||a.loaded)a.src&&!a.loadError&&(o=i.createEl("pswp__img","img"),o.style.opacity=1,o.src=a.src,dn(a,o),un(t,a,l,o,!0));else{if(a.loadComplete=function(n){if(u){if(e&&e.index===t){if(pn(n,!0))return n.loadComplete=n.img=null,sn(n,he),Fe(n),void(e.index===d&&r.updateCurrZoomItem());n.imageAppended?!$t&&n.placeholder&&(n.placeholder.style.display="none",n.placeholder=null):z.transform&&(ie||$t)?on.push({item:n,baseDiv:l,img:n.img,index:t,holder:e,clearPlaceholder:!0}):un(t,n,l,n.img,ie||$t,!0)}n.loadComplete=null,n.img=null,Se("imageLoadComplete",t,n)}},i.features.transform){var c="pswp__img pswp__img--placeholder";c+=a.msrc?"":" pswp__img--placeholder--blank";var p=i.createEl(c,a.msrc?"img":"");a.msrc&&(p.src=a.msrc),dn(a,p),l.appendChild(p),a.placeholder=p}a.loading||cn(a),r.allowProgressiveImg()&&(!Xt&&z.transform?on.push({item:a,baseDiv:l,img:a.img,index:t,holder:e}):un(t,a,l,a.img,!0,!0))}Xt||t!==d?Fe(a):(oe=l.style,tn(a,o||a.img)),e.el.innerHTML="",e.el.appendChild(l)},cleanSlide:function(e){e.img&&(e.img.onload=e.img.onerror=null),e.loaded=e.loading=e.img=e.imageAppended=!1}}});var mn,hn={},vn=function(e,t,n){var o=document.createEvent("CustomEvent"),i={origEvent:e,target:e.target,releasePoint:t,pointerType:n||"touch"};o.initCustomEvent("pswpTap",!0,!0,i),e.target.dispatchEvent(o)};Ee("Tap",{publicMethods:{initTap:function(){Oe("firstTouchStart",r.onTapStart),Oe("touchRelease",r.onTapRelease),Oe("destroy",function(){hn={},mn=null})},onTapStart:function(e){e.length>1&&(clearTimeout(mn),mn=null)},onTapRelease:function(e,t){if(t&&!V&&!Y&&!Je){var n=t;if(mn&&(clearTimeout(mn),mn=null,_t(n,hn)))return void Se("doubleTap",n);if("mouse"===t.type)return void vn(e,t,"mouse");var o=e.target.tagName.toUpperCase();if("BUTTON"===o||i.hasClass(e.target,"pswp__single-tap"))return void vn(e,t);Le(hn,n),mn=setTimeout(function(){vn(e,t),mn=null},300)}}}});var yn;Ee("DesktopZoom",{publicMethods:{initDesktopZoom:function(){L||(k?Oe("mouseUsed",function(){r.setupDesktopZoom()}):r.setupDesktopZoom(!0))},setupDesktopZoom:function(t){yn={};var n="wheel mousewheel DOMMouseScroll";Oe("bindEvents",function(){i.bind(e,n,r.handleMouseWheel)}),Oe("unbindEvents",function(){yn&&i.unbind(e,n,r.handleMouseWheel)}),r.mouseZoomedIn=!1;var o,a=function(){r.mouseZoomedIn&&(i.removeClass(e,"pswp--zoomed-in"),r.mouseZoomedIn=!1),w<1?i.addClass(e,"pswp--zoom-allowed"):i.removeClass(e,"pswp--zoom-allowed"),l()},l=function(){o&&(i.removeClass(e,"pswp--dragging"),o=!1)};Oe("resize",a),Oe("afterChange",a),Oe("pointerDown",function(){r.mouseZoomedIn&&(o=!0,i.addClass(e,"pswp--dragging"))}),Oe("pointerUp",l),t||a()},handleMouseWheel:function(e){if(w<=r.currItem.fitRatio)return s.modal&&(!s.closeOnScroll||Je||q?e.preventDefault():P&&Math.abs(e.deltaY)>2&&(p=!0,r.close())),!0;if(e.stopPropagation(),yn.x=0,"deltaX"in e)1===e.deltaMode?(yn.x=18*e.deltaX,yn.y=18*e.deltaY):(yn.x=e.deltaX,yn.y=e.deltaY);else if("wheelDelta"in e)e.wheelDeltaX&&(yn.x=-.16*e.wheelDeltaX),e.wheelDeltaY?yn.y=-.16*e.wheelDeltaY:yn.y=-.16*e.wheelDelta;else{if(!("detail"in e))return;yn.y=e.detail}Be(w,!0);var t=me.x-yn.x,n=me.y-yn.y;(s.modal||t<=ne.min.x&&t>=ne.max.x&&n<=ne.min.y&&n>=ne.max.y)&&e.preventDefault(),r.panTo(t,n)},toggleDesktopZoom:function(t){t=t||{x:he.x/2+ye.x,y:he.y/2+ye.y};var n=s.getDoubleTapZoom(!0,r.currItem),o=w===n;r.mouseZoomedIn=!o,r.zoomTo(o?r.currItem.initialZoomLevel:n,t,333),i[(o?"remove":"add")+"Class"](e,"pswp--zoomed-in")}}});var wn,gn,xn,bn,_n,Cn,En,In,Tn,On,Sn,Dn,Pn={history:!0,galleryUID:1},Mn=function(){return Sn.hash.substring(1)},kn=function(){wn&&clearTimeout(wn),xn&&clearTimeout(xn)},Fn=function(){var e=Mn(),t={};if(e.length<5)return t;var n,o=e.split("&");for(n=0;n-1&&(En=En.substring(0,t),"&"===En.slice(-1)&&(En=En.slice(0,-1))),setTimeout(function(){u&&i.bind(window,"hashchange",r.onHashChange)},40)}},onHashChange:function(){return Mn()===En?(Tn=!0,void r.close()):void(bn||(_n=!0,r.goTo(Fn().pid),_n=!1))},updateURL:function(){kn(),_n||(In?wn=setTimeout(An,800):An())}}}),i.extend(r,ot)};return e})},function(e,t,n){var o,i;!function(r,a){o=a,i="function"==typeof o?o.call(t,n,t,e):o,!(void 0!==i&&(e.exports=i))}(this,function(){"use strict";var e=function(e,t){var n,o,i,r,a,l,s,u,c,p,d,f,m,h,v,y,w,g,x,b=this,_=!1,C=!0,E=!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,clickToCloseNonZoomable:!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}],getImageURLForShare:function(){return e.currItem.src||""},getPageURLForShare:function(){return window.location.href},getTextForShare:function(){return e.currItem.title||""},indexIndicatorSep:" / ",fitControlsWidth:1200},T=function(e){if(y)return!0;e=e||window.event,v.timeToIdle&&v.mouseUsed&&!c&&N();for(var n,o,i=e.target||e.srcElement,r=i.getAttribute("class")||"",a=0;a-1&&(n.onTap(),o=!0);if(o){e.stopPropagation&&e.stopPropagation(),y=!0;var l=t.features.isOldAndroid?600:30;w=setTimeout(function(){y=!1},l)}},O=function(){return!e.likelyTouchDevice||v.mouseUsed||screen.width>v.fitControlsWidth},S=function(e,n,o){t[(o?"add":"remove")+"Class"](e,"pswp__"+n)},D=function(){var e=1===v.getNumItemsFn();e!==h&&(S(o,"ui--one-slide",e),h=e)},P=function(){S(s,"share-modal--hidden",E)},M=function(){return E=!E,E?(t.removeClass(s,"pswp__share-modal--fade-in"),setTimeout(function(){E&&P()},300)):(P(),setTimeout(function(){E||t.addClass(s,"pswp__share-modal--fade-in")},30)),E||F(),!1},k=function(t){t=t||window.event;var n=t.target||t.srcElement;return e.shout("shareLinkClick",t,n),!!n.href&&(!!n.hasAttribute("download")||(window.open(n.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)),E||M(),!1))},F=function(){for(var e,t,n,o,i,r="",a=0;a