You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zhishifufei_php/public/static/plug/vue-photo-preview/vue-photo-preview.js

8 lines
55 KiB

1 year ago
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("vue-photo-preview",[],t):"object"==typeof exports?exports["vue-photo-preview"]=t():e["vue-photo-preview"]=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=1)}([function(e,t,n){"use strict";var o=n(7),i=(n.n(o),n(8));n.n(i);t.a={}},function(e,t,n){"use strict";function o(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function o(i,r){try{var a=t[i](r),l=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(l).then(function(e){o("next",e)},function(e){o("throw",e)});e(l)}return o("next")})}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),r=n.n(i),a=n(5),l=n(10),s=n.n(l),u=n(11),c=n.n(u),d=void 0,p={install:function(e,t){var n=e.extend(a.a),t=t||{};d||(d=new n({el:document.createElement("div")}),document.body.appendChild(d.$el));var i=void 0,l=void 0;e.prototype.$preview={self:null,on:function(e,t){i=e,l=t}},e.mixin({data:function(){return{galleryElements:null,galleryPicLoading:!1}},methods:{$previewRefresh:function(){var e=this;setTimeout(function(){e.galleryElements=document.querySelectorAll("img[preview]");for(var t=0,n=e.galleryElements.length;t<n;t++)e.galleryElements[t].setAttribute("data-pswp-uid",t+1),e.galleryElements[t].onclick=e.onThumbnailsClick},200)},onThumbnailsClick:function(e){if(this.galleryPicLoading)return!1;this.galleryPicLoading=!0,e=e||window.event,e.preventDefault?e.preventDefault():e.returnValue=!1;var t,n=e.target||e.srcElement,o=n.getAttribute("preview");t=o?document.querySelectorAll('img[preview="'+o+'"]'):document.querySelectorAll("img[preview]");for(var i,r=t,a=0;a<r.length;a++)if(r[a]===n){i=a;break}return i>=0&&(this.openPhotoSwipe(i,r),this.$emit("preview-open",e,n.src)),!1},openPhotoSwipe:function(n,a,u,p){var f=this;return o(r.a.mark(function o(){var m,h,v,g,w,y,x,b,_;return r.a.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return m=document.querySelectorAll(".pswp")[0],o.next=3,f.parseThumbnailElements(a);case 3:if(g=o.sent,v={getThumbBoundsFn:function(e){var t=g[e].el,n=window.pageYOffset||document.documentElement.scrollTop,o=t.getBoundingClientRect();return{x:o.left,y:o.top+n,w:o.width}},addCaptionHTMLFn:function(e,t,n){return e.title?(t.children[0].innerHTML=e.title,!0):(t.children[0].innerText="",!1)},showHideOpacity:!0,history:!1,shareEl:!1,maxSpreadZoom:3,getDoubleTapZoom:function(e,t){return e?1.5:t.initialZoomLevel<.7?1:1.5}},!p){o.next=20;break}if(!v.galleryPIDs){o.next=17;break}w=0;case 8:if(!(w<g.length)){o.next=15;break}if(g[w].pid!=n){o.next=12;break}return v.index=w,o.abrupt("break",15);case 12:w++,o.next=8;break;case 15:o.next=18;break;case 17:v.index=parseInt(n,10)-1;case 18:o.next=21;break;case 20:v.index=parseInt(n,10);case 21:if(!isNaN(v.index)){o.next=23;break}return o.abrupt("return");case 23:v=f.extend(v,t),u&&(v.showAnimationDuration=0),h=new s.a(m,c.a,g,v),e.prototype.$preview.self=h,x=!1,b=!0,h.listen("beforeResize",function(){var e=window.devicePixelRatio?window.devicePixelRatio:1;e=Math.min(e,2.5),y=h.viewportSize.x*e,y>=1200||!h.likelyTouchDevice&&y>800||screen.width>1200?x||(x=!0,_=!0):x&&(x=!1,_=!0),_&&!b&&h.invalidateCurrItems(),b&&(b=!1),_=!1}),h.listen("gettingData",function(e,t){t.el.getAttribute("large")?(t.src=t.o.src,t.w=t.o.w,t.h=t.o.h):(t.src=t.m.src,t.w=t.m.w,t.h=t.m.h)}),h.listen("imageLoadComplete",function(e,t){f.galleryPicLoading=!1}),h.listen(i,l),h.init(),d.$el.classList=d.$el.classList+" pswp--zoom-allowed";case 34:case"end":return o.stop()}},o,f)}))()},parseThumbnailElements:fu
* http://photoswipe.com
* Copyright (c) 2019 Dmitry Semenov; */
!function(r,a){o=a,void 0!==(i="function"==typeof o?o.call(t,n,t,e):o)&&(e.exports=i)}(0,function(){"use strict";return function(e,t,n,o){var i={features:null,bind:function(e,t,n,o){var i=(o?"remove":"add")+"EventListener";t=t.split(" ");for(var r=0;r<t.length;r++)t[r]&&e[i](t[r],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){i.bind(e,t,n,!0)},removeClass:function(e,t){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")},addClass:function(e,t){i.hasClass(e,t)||(e.className+=(e.className?" ":"")+t)},hasClass:function(e,t){return e.className&&new RegExp("(^|\\s)"+t+"(\\s|$)").test(e.className)},getChildByClass:function(e,t){for(var n=e.firstChild;n;){if(i.hasClass(n,t))return n;n=n.nextSibling}},arraySearch:function(e,t,n){for(var o=e.length;o--;)if(e[o][n]===t)return o;return-1},extend:function(e,t,n){for(var o in t)if(t.hasOwnProperty(o)){if(n&&e.hasOwnProperty(o))continue;e[o]=t[o]}},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(i.features)return i.features;var e=i.createEl(),t=e.style,n="",o={};if(o.oldIE=document.all&&!document.addEventListener,o.touch="ontouchstart"in window,window.requestAnimationFrame&&(o.raf=window.requestAnimationFrame,o.caf=window.cancelAnimationFrame),o.pointerEvent=!!window.PointerEvent||navigator.msPointerEnabled,!o.pointerEvent){var r=navigator.userAgent;if(/iP(hone|od)/.test(navigator.platform)){var a=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);a&&a.length>0&&(a=parseInt(a[1],10))>=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,d=["transform","perspective","animationName"],p=["","webkit","Moz","ms","O"],f=0;f<4;f++){n=p[f];for(var m=0;m<3;m++)u=d[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;l<t.length;l++)if(i=t[l])if("object"==typeof n&&n.handleEvent){if(o){if(!n["oldIE"+i])return!1}else n["oldIE"+i]=a;e[r]("on"+i,n["oldIE"+i])}else e[r]("on"+i,n)});var r=this,a={allowPanToNext:!0,spacing:.12,bgOpacity:1,mouseUsed:!1,loop:!0,pinchToClose:!0,closeOnScroll:!0,closeOnVerticalDrag:!0,verticalDragRange:.75,hideAnimationDuration:333,showAnimationDuration:333,showHideOpacity:!1,focus:!0,escKey:!0,arrowKeys:!0,mainScrollEndFriction:.35,panEndFriction:.35,isClickableElement:function(e){return"A"===e.tagName},getDoubleTapZoom:function(e,t){return e?1:t.initialZoomLevel<.7?1:1.33},maxSpreadZoom:1.33,modal:!0,scaleMode:"fit"};i.extend(a,o);var l,s,u,c,d,p,f,m,h,v,g,w,y,x,b,_,C,T,E,I,S,k,D,O,L,F,A,M,R,P,Z,z,N,U,K,H,W,B,G,Y,j,q,$,V,X,J,Q,ee,te,ne,oe,ie,re,ae,le,se,ue,ce=function(){return{x:0,y:0}},de=ce(),pe=ce(),fe=ce(),me={},he=0,ve={},ge=ce(),we=0,ye=!0,xe=[],be={},_e=!1,Ce=function(e,t){i.extend(r,t.publicMethods),xe.push(e)},Te=function(e){var t=Vt();return e>t-1?e-t:e<0?t+e:e},Ee={},Ie=function(e,t){return Ee[e]||(Ee[e]=[]),Ee[e].push(t)},Se=function(e){var t=Ee[e];if(t){var n=Array.prototype.slice.call(arguments);n.shift();for(var o=0;o<t.length;o++)t[o
* http://photoswipe.com
* Copyright (c) 2019 Dmitry Semenov; */
!function(r,a){o=a,void 0!==(i="function"==typeof o?o.call(t,n,t,e):o)&&(e.exports=i)}(0,function(){"use strict";return function(e,t){var n,o,i,r,a,l,s,u,c,d,p,f,m,h,v,g,w,y,x,b=this,_=!1,C=!0,T=!0,E={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},I=function(e){if(g)return!0;e=e||window.event,v.timeToIdle&&v.mouseUsed&&!c&&P();for(var n,o,i=e.target||e.srcElement,r=i.getAttribute("class")||"",a=0;a<B.length;a++)n=B[a],n.onTap&&r.indexOf("pswp__"+n.name)>-1&&(n.onTap(),o=!0);if(o){e.stopPropagation&&e.stopPropagation(),g=!0;var l=t.features.isOldAndroid?600:30;w=setTimeout(function(){g=!1},l)}},S=function(){return!e.likelyTouchDevice||v.mouseUsed||screen.width>v.fitControlsWidth},k=function(e,n,o){t[(o?"add":"remove")+"Class"](e,"pswp__"+n)},D=function(){var e=1===v.getNumItemsFn();e!==h&&(k(o,"ui--one-slide",e),h=e)},O=function(){k(s,"share-modal--hidden",T)},L=function(){return T=!T,T?(t.removeClass(s,"pswp__share-modal--fade-in"),setTimeout(function(){T&&O()},300)):(O(),setTimeout(function(){T||t.addClass(s,"pswp__share-modal--fade-in")},30)),T||A(),!1},F=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)),T||L(),!1))},A=function(){for(var e,t,n,o,i,r="",a=0;a<v.shareButtons.length;a++)e=v.shareButtons[a],n=v.getImageURLForShare(e),o=v.getPageURLForShare(e),i=v.getTextForShare(e),t=e.url.replace("{{url}}",encodeURIComponent(o)).replace("{{image_url}}",encodeURIComponent(n)).replace("{{raw_image_url}}",n).replace("{{text}}",encodeURIComponent(i)),r+='<a href="'+t+'" target="_blank" class="pswp__share--'+e.id+'"'+(e.download?"download":"")+">"+e.label+"</a>",v.parseShareButtonOut&&(r=v.parseShareButtonOut(e,r));s.children[0].innerHTML=r,s.children[0].onclick=F},M=function(e){for(var n=0;n<v.closeElClasses.length;n++)if(t.hasClass(e,"pswp__"+v.closeElClasses[n]))return!0},R=0,P=function(){clearTimeout(x),R=0,c&&b.setIdle(!1)},Z=function(e){e=e||window.event;var t=e.relatedTarget||e.toElement;t&&"HTML"!==t.nodeName||(clearTimeout(x),x=setTimeout(function(){b.setIdle(!0)},v.timeToIdleOutside))},z=function(){v.fullscreenEl&&!t.features.isOldAndroid&&(n||(n=b.getFullscreenAPI()),n?(t.bind(document,n.eventK,b.updateFullscreen),b.updateFullscreen(),t.addClass(e.template,"pswp--supports-fs")):t.removeClass(e.template,"pswp--supports-fs"))},N=function(){v.preloaderEl&&(U(!0),d("beforeChange",function(){clearTimeout(m),m=setTimeout(function(){e.currItem&&e.currItem.loading?(!e.allowProgressiveImg()||e.currItem.img&&!e.currItem.img.naturalWidth)&&U(!1):U(!0)},v.loadingIndicatorDelay)}),d("imageLoadComplete",function(t,n){e.currItem===n&&U(!0)}))},U=function(e){f!==e&&(k(p,"preloader--active",!e),f=e)},K=function(e){var n=e.vGap;if(S()){var a=v.barsSize;if(v.captionEl&&"auto"===a.bottom)if(r||(r=t.createEl("pswp__caption pswp__caption--fake"),r.appendChild(t.createEl(
//# sourceMappingURL=vue-photo-preview.js.map