heroweb/templatesrcpoc/assets/js/plugins/photoswipe-ui-default.min.js

7 lines
9.6 KiB
JavaScript
Raw Normal View History

2024-09-02 06:01:44 +00:00
/**
*
* UI on top of main sliding area (caption, arrows, close button, etc.).
* Built just using public methods/properties of PhotoSwipe.
*
*/
!function(b,a){"function"==typeof define&&define.amd?define(a):"object"==typeof exports?module.exports=a():b.PhotoSwipeUI_Default=a()}(this,function(){return function(b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,a=this,w=!1,x=!0,y=!0,z={barsSize:{top:44,bottom:"auto"},closeElClasses:["item","caption","zoom-wrap","ui","top-bar"],timeToIdle:4e3,timeToIdleOutside:1e3,loadingIndicatorDelay:1e3,addCaptionHTMLFn:function(a,b){return a.title?(b.children[0].innerHTML=a.title,!0):(b.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 b.currItem.src||""},getPageURLForShare:function(){return window.location.href},getTextForShare:function(){return b.currItem.title||""},indexIndicatorSep:" / ",fitControlsWidth:1200},A=function(a){if(s)return!0;a=a||window.event,r.timeToIdle&&r.mouseUsed&&!l&&J();for(var b,e,f=(a.target||a.srcElement).getAttribute("class")||"",d=0;d<R.length;d++)(b=R[d]).onTap&&f.indexOf("pswp__"+b.name)> -1&&(b.onTap(),e=!0);e&&(a.stopPropagation&&a.stopPropagation(),s=!0,t=setTimeout(function(){s=!1},c.features.isOldAndroid?600:30))},B=function(a,b,d){c[(d?"add":"remove")+"Class"](a,"pswp__"+b)},C=function(){var a=1===r.getNumItemsFn();a!==q&&(B(e,"ui--one-slide",a),q=a)},D=function(){B(j,"share-modal--hidden",y)},E=function(){return(y=!y)?(c.removeClass(j,"pswp__share-modal--fade-in"),setTimeout(function(){y&&D()},300)):(D(),setTimeout(function(){y||c.addClass(j,"pswp__share-modal--fade-in")},30)),y||G(),!1},F=function(a){var c=(a=a||window.event).target||a.srcElement;return b.shout("shareLinkClick",a,c),!!c.href&&(!!c.hasAttribute("download")||(window.open(c.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)),y||E(),!1))},G=function(){for(var a,e,c,f,g,b="",d=0;d<r.shareButtons.length;d++)a=r.shareButtons[d],c=r.getImageURLForShare(a),f=r.getPageURLForShare(a),g=r.getTextForShare(a),e=a.url.replace("{{url}}",encodeURIComponent(f)).replace("{{image_url}}",encodeURIComponent(c)).replace("{{raw_image_url}}",c).replace("{{text}}",encodeURIComponent(g)),b+='<a href="'+e+'" target="_blank" class="pswp__share--'+a.id+'"'+(a.download?"download":"")+">"+a.label+"</a>",r.parseShareButtonOut&&(b=r.parseShareButtonOut(a,b));j.children[0].innerHTML=b,j.children[0].onclick=F},H=function(b){for(var a=0;a<r.closeElClasses.length;a++)if(c.hasClass(b,"pswp__"+r.closeElClasses[a]))return!0},I=0,J=function(){clearTimeout(v),I=0,l&&a.setIdle(!1)},K=function(b){var c=(b=b||window.event).relatedTarget||b.toElement;c&&"HTML"!==c.nodeName||(clearTimeout(v),v=setTimeout(function(){a.setIdle(!0)},r.timeToIdleOutside))},L=function(){r.fullscreenEl&&!c.features.isOldAndroid&&(d||(d=a.getFullscreenAPI()),d?(c.bind(document,d.eventK,a.updateFullscreen),a.updateFullscreen(),c.addClass(b.template,"pswp--supports-fs")):c.removeClass(b.template,"pswp--supports-fs"))},M=function(){r.preloaderEl&&(N(!0),m("beforeChange",function(){clearTimeout(p),p=setTimeout(function(){b.currItem&&b.currItem.loading?b.allowProgressiveImg()&&(!b.currItem.img||b.currItem.img.naturalWidth)||N(!1):N(!0)},r.loadingIndicatorDelay)}),m("imageLoadComplete",function(c,a){b.currItem===a&&N(!0)}))},N=function(a){o!==a&&(B(n,"preloader--active",!a),o=a)},O=function(h){var a=h.vGap;if(!b.likelyTouchDevice||r.mouseUsed||screen.width>r.fitControlsWidth){var d=r.barsSize;if(r.captionEl&&"auto"===d.bottom){if(g||((g=c.createEl("pswp__caption pswp__caption--fake")).appendChild(c.createE