https://www.ohpolly.com/cdn/shop/t/1735/assets/product-photoswipe.js?v=71261704396576992291782836742
1const{getElement}=window.BAO.Utils,PhotoSwipe=window.PhotoSwipe,PhotoSwipeLightbox=window.PhotoSwipeLightbox;export class ProductPhotoSwipe extends window.BAO.CustomElement(){connectedCallback(){super.connectedCallback(),this.els?.link?.exists&&(this.photoSwipeInstance=new PhotoSwipeLightbox({loop:!1,showAnimationDuration:500,scaleMode:"zoom",initialZoomLevel:"fit",secondaryZoomLevel:1,maxZoomLevel:1.5,gallery:this,children:this.els.link.selector,bgOpacity:1,arrowPrev:!0,arrowNext:!0,zoom:!1,close:!1,counter:!1,preloadFirstSlide:!1,closeOnVerticalDrag:!0,tapAction:"zoom",pswpModule:()=>PhotoSwipe}),this.setupPhotoSwipeListeners(),this.photoSwipeInstance.init())}setupListeners(){super.setupListeners()}setupPhotoSwipeListeners(){this.photoSwipeInstance.on("uiRegister",()=>{this.addCloseButton(),this.addPreviousButton(),this.addNextButton(),this.addZoomSlider()}),this.photoSwipeInstance.on("change",()=>{this.handleSlideChange()})}addCloseButton(){this.photoSwipeInstance.pswp.ui.registerElement({name:"custom-close",className:"pswp-Action_Close",ariaLabel:window.theme.strings.photoswipe.close,order:2,isButton:!0,html:this.closeSvg,onClick:()=>{this.photoSwipeInstance.pswp.close()}})}addPreviousButton(){this.photoSwipeInstance.pswp.ui.registerElement({name:"custom-prev",className:"pswp-Action_Arrow pswp-Action_Arrow-previous",ariaLabel:"Previous",appendTo:"wrapper",order:1,isButton:!0,html:this.arrowSvg,onClick:()=>{this.photoSwipeInstance.pswp.prev()}})}addNextButton(){this.photoSwipeInstance.pswp.ui.registerElement({name:"custom-next",className:"pswp-Action_Arrow pswp-Action_Arrow-next",ariaLabel:"Next",appendTo:"wrapper",order:1,isButton:!0,html:this.arrowSvg,onClick:()=>{this.photoSwipeInstance.pswp.next()}})}addZoomSlider(){this.photoSwipeInstance.pswp.ui.registerElement({name:"zoom-slider",order:10,isButton:!1,appendTo:"root",html:`<div class="pswp-ZoomSlider"> 2 <button class="pswp-ZoomSlider_Control pswp-ZoomSlider_Control-zoomOut" data-pswp-el="zoom-out" title="Zoom Out" type="button"> 3 <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16"> 4 <path stroke="currentColor" d="M4 8h8"/> 5 </svg> 6 </button> 7 8 <input type="range" min="0" max="4" step="0.1" value="1" class="pswp-ZoomSlider_Input"> 9 10 <button class="pswp-ZoomSlider_Control pswp-ZoomSlider_Control-zoomIn" data-pswp-el="zoom-in" title="Zoom In" type="button"> 11 <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16"> 12 <path stroke="currentColor" d="M4 8h8M7.995 12.005v-8"/> 13 </svg> 14 </button> 15 </div>`,onInit:(el,pswp)=>{const slider=el.querySelector(".pswp-ZoomSlider_Input"),updateSlider=()=>{const slide=pswp.currSlide,content=slide?.content;if(!(slide&&typeof slide.isZoomable=="function"?slide.isZoomable():!1)){el.style.display="none";return}const zoomLevel=pswp.currSlide.currZoomLevel||content?.scale||1,minZoomLevel=slide.zoomLevels.min,maxZoomLevel=slide.zoomLevels.max;el.style.display="block",slider.min=minZoomLevel,slider.max=maxZoomLevel,slider.value=zoomLevel.toFixed(2)},updateZoom=()=>{const zoom=parseFloat(slider.value);pswp.currSlide?.content?.isZoomable&&pswp.zoomTo(zoom,{x:pswp.viewportSize.x/2,y:pswp.viewportSize.y/2},0)};pswp.on("zoomPanUpdate",updateSlider),pswp.on("change",updateSlider),pswp.on("contentResize",updateSlider),slider.addEventListener("input",()=>{updateZoom()}),el.addEventListener("touchstart",e=>{e.stopPropagation()},{passive:!0}),el.addEventListener("touchmove",e=>{e.stopPropagation()},{passive:!0}),el.addEventListener("click",e=>{e.stopPropagation()},{passive:!0}),el.querySelector('[data-pswp-el="zoom-out"]').addEventListener("click",()=>{slider.value=slider.value*1-.5,updateZoom()}),el.querySelector('[data-pswp-el="zoom-in"]').addEventListener("click",()=>{slider.value=slider.value*1+.5,updateZoom()})}})}handleSlideChange(){const{pswp}=this.photoSwipeInstance,previousEl=getElement(".pswp-Action_Arrow-previous"),nextEl=getElement(".pswp-Action_Arrow-next");pswp&&previousEl&&(previousEl.disabled=pswp.currIndex===0),pswp&&nextEl&&(nextEl.disabled=pswp.currIndex+1===pswp.getNumItems())}get closeSvg(){return` 16 <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
17 <path fill="currentColor" d="m12.795 12 2.602-2.603a.562.562 0 0 0-.795-.795L12 11.205 9.397 8.602a.562.562 0 0 0-.795.795L11.205 12l-2.603 2.602a.563.563 0 0 0 .795.795L12 12.795l2.602 2.602a.563.563 0 1 0 .795-.795z"/> 18 </svg> 19 `}get arrowSvg(){return` 20 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 21 <path d="M9.80203 15.8052V7.80518L15.182 11.3891C15.479 11.5869 15.479 12.0234 15.182 12.2213L9.80203 15.8052Z" fill="currentColor"/> 22 </svg> 23 `}}customElements.get("product-photoswipe")||customElements.define("product-photoswipe",ProductPhotoSwipe); 24//# sourceMappingURL=/cdn/shop/t/1735/assets/product-photoswipe.js.map?v=71261704396576992291782836742
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.