PageSourceSearch

https://citizenwatch.eu/static/js/main__productgallery.js?d994694d…1f8c6a0e12fd71aa0d8656a4f13ad88a92c6e97b2d8

js citizenwatch.eu collected 2026-10-03 22:17:27 UTC 11,204 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkNorden_Commerce=globalThis.webpackChunkNorden_Commerce||[]).push([[8166],{1011(e,t,i){i.d(t,{ProductGallery:()=>h,productGalleryInit:()=>n});var s=i(4561);class o{constructor(e){this.gallery=e.gallery,this.imageWrapper=this.gallery.querySelector("[data-product-zoom-image]")||document.querySelector("[data-product-zoom-image]"),this.mouseWheelZoom=e.mouseWheelZoom,this.showZoomLevel=e.showZoomLevel,this.zoomLevelContainer=this.gallery.querySelector("[data-product-zoom-level]"),this.zoomFactorControls=e.zoomFactorControls,this.zoom=!1,this.zoomFactor=e.zoomFactor,this.defaultZoomFactor=e.zoomFactor,this.minZoomFactor=e.minZoomFactor,this.maxZoomFactor=e.maxZoomFactor,this.lens=null,this.enterTimeout=null,this.exitTimeout=null}init(){const e=this.gallery.querySelectorAll("[data-product-main-image='detail']");if(this.zoomFactorControls&&this.handleZoomFactor(),document.documentElement.classList.contains("no-touchevents"))for(let t of e)t.addEventListener("mouseenter",e=>{this.handleZoom(t,e)},!1),t.addEventListener("mouseleave",e=>{clearTimeout(this.enterTimeout),this.zoom&&this.handleExit(t,e)})}handleZoomFactor(){const e=document.querySelectorAll("[data-product-zoom-factor]");for(let t of e)t.addEventListener("click",()=>{this.zoomFactor=parseInt(t.getAttribute("data-zoom")),t.parentNode.querySelector(".is-active").classList.remove("is-active"),t.classList.add("is-active")})}handleZoom(e,t){const i=t;i.preventDefault(),this.enterTimeout=setTimeout(()=>{clearTimeout(this.exitTimeout);let t=new Image;t.src=e.src,t.onload=()=>{const s=t.naturalWidth,o=t.naturalHeight;if(!this.zoom){const t=e.getBoundingClientRect(),l=this.gallery.querySelector("[data-product-main-image-wrap]").getBoundingClientRect(),a=t.width,h=t.height;i.pageX,l.left,window.pageXOffset,l.width,i.pageY,l.top,window.pageYOffset,l.height;e.setAttribute("data-title",e.getAttribute("title")),e.setAttribute("title",""),this.imageWrapper.style.backgroundImage="url("+e.getAttribute("data-zoom-image")+")",this.imageWrapper.style.backgroundSize=`${a*this.zoomFactor}px ${h*this.zoomFactor}px`,this.lens?this.lens=this.gallery.querySelector("[data-product-zoom-lens]"):(this.lens=document.createElement("span"),this.lens.classList.add("c-product__zoom-image-lens"),this.lens.setAttribute("data-product-zoom-lens","")),this.gallery.querySelector("[data-product-main-image-wrap]").appendChild(this.lens),this.lens.style.display="block",this.imageWrapper.classList.remove("is-exiting"),this.imageWrapper.classList.add("is-visible"),this.zoom=!0,this.gallery.classList.add("innerzoom-active"),this.showZoomLevel&&(this.zoomLevelContainer.innerText=`${this.zoomFactor.toFixed(1)}x`),this.mouseWheelZoom&&e.addEventListener("wheel",t=>{t.preventDefault();let i=t.deltaY/-600;this.zoomFactor+=i,this.zoomFactor=Math.min(Math.max(this.minZoomFactor,this.zoomFactor),this.maxZoomFactor),this.showZoomLevel&&(!this.zoomLevelContainer.classList.contains("is-visible")&&this.zoomFactor>this.minZoomFactor?this.zoomLevelContainer.classList.add("is-visible"):this.zoomLevelContainer.classList.contains("is-visible")&&this.zoomFactor===this.minZoomFactor&&this.zoomLevelContainer.classList.remove("is-visible"),this.zoomLevelContainer.innerText=`${this.zoomFactor.toFixed(1)}x`),this.handleMoveCalculation(e,s,o,this.zoomFactor,t)})}this.handleMove(e,s,o)}},0)}handleMove(e,t,i){e.addEventListener("mousemove",s=>{this.handleMoveCalculation(e,t,i,this.zoomFactor,s)},!1),e.addEventListener("touchmove",s=>{this.handleMoveCalculation(e,t,i,this.zoomFactor,s.changedTouches[0])},!1)}handleMoveCalculation(e,t,i,s,o){const l=e.getBoundingClientRect(),a=this.gallery.querySelector("[data-product-main-image-wrap]").getBoundingClientRect(),h=l.width,n=l.height,r=o.offsetX||o.pageX-l.left-window.pageXOffset,d=o.offsetY||o.pageY-l.top-window.pageYOffset;let m=r-this.lens.offsetWidth/2,c=(r-this.lens.offsetWidth/2)/h*100,p=d-this.lens.offsetHeight/2,u=(d-this.lens.offsetHeight/2)/n*100;m<0&&(m=0),m>e.offsetWidth-this.lens.offsetWidth&&(m=e.offsetWidth-this.lens.offsetWidth),p<0&&(p=0),p>e.offsetHeight-this.lens.offsetHeight&&(p=e.offsetHeight-this.lens.offsetHeight),c<0&&(c=0),c>(l.width-this.lens.offsetWidth)/h*100&&(c=(l.width-this.lens.offsetWidth)/h*100),u<0&&(u=0),u>
1(l.height-this.lens.offsetHeight)/n*100&&(u=(l.height-this.lens.offsetHeight)/n*100);let g=m-(h-l.width)/2,w=p-(n-l.height)/2;g>t-this.lens.offsetWidth&&(g=t-this.lens.offsetWidth),w>i-this.lens.offsetHeight&&(w=i-this.lens.offsetHeight),this.imageWrapper.style.backgroundPositionX=`-${g*s}px`,this.imageWrapper.style.backgroundPositionY=`-${w*s}px`,this.imageWrapper.style.backgroundSize=`${h*s}px ${n*s}px`,this.lens.style.width=this.imageWrapper.offsetWidth/s+"px",this.lens.style.height=this.imageWrapper.offsetHeight/s+"px",this.lens.style.left=`${m+(a.width-h)/2}px`,this.lens.style.top=`${p+(a.height-n)/2}px`}handleExit(e,t){this.imageWrapper.classList.remove("is-visible"),this.imageWrapper.classList.add("is-exiting"),this.showZoomLevel&&this.gallery.querySelector("[data-product-zoom-level]").classList.remove("is-visible"),this.lens.style.display="none",e.title=e.getAttribute("data-title"),e.setAttribute("data-title",""),this.zoomFactor=this.defaultZoomFactor,this.zoom=!1,this.gallery.classList.remove("innerzoom-active")}}var l=i(8196);class a{constructor(e){this.gallery=e.gallery,this.gallerySlideshow=e.gallerySlideshow,this.zoomGallery=this.gallery.querySelector("[data-zoom-gallery]"),this.slideshowOptions=e.slideshowOptions}init(){if(this.zoomGallery){this.zoomGallerySlideshow=this.zoomGallery.querySelector("[data-zoom-gallery-slideshow]");const e=this.gallery.querySelectorAll("[data-zoom-gallery-trigger]");for(const t of e)t.addEventListener("click",e=>{if(this.gallerySlideshow)if(this.gallerySlideshow.swiper.allowClick){const i=this.gallerySlideshow.swiper.activeIndex;this.handleOpen(e,t,i)}else e.preventDefault(),e.stopImmediatePropagation();else this.handleOpen(e,t,0)});document.addEventListener("Litebox:afteropen",e=>{"video"===e.detail.inst._contentType&&(this.videoOpen=!0)}),document.addEventListener("Litebox:afterclose",e=>{"video"===e.detail.inst._contentType&&(this.videoOpen=!1)})}}handleOpen(e,t,i){e.preventDefault(),e.stopImmediatePropagation(),this.activeElement=document.activeElement,Litebox.open({extraClasses:"litebox--zoom-gallery",trigger:t,src:this.zoomGallery,variant:"modal",fullsize:!0,onBeforeopen:e=>{e._isSlideshow=!0},onAfteropen:s=>{this.handleSlideshow(e,t,i)}})}async handleSlideshow(e,t,i){if(this.slideshowOptions.direction="horizontal",this.slideshowOptions.autoplay.enabled=!1,this.slideshowOptions.pagination.enabled=!1,this.slideshowOptions.scrollbar.enabled=!0,this.slideshowOptions.responsive)for(const e of this.slideshowOptions.responsive)e.settings.pagination.enabled=!1,e.settings.scrollbar.enabled=!0;if(this.zoomGallerySlideshow.classList.contains("swiper-initialized")||(this.swiper=await(0,l.N)(this.zoomGallerySlideshow,this.slideshowOptions)),this.swiper.slideTo(i,0),setTimeout(()=>{const e=this.swiper.slides[this.swiper.activeIndex];e&&e.querySelector("img").focus()},100),this.isVideo(t)&&"IMG"!==e.target.tagName){const e=this.swiper.activeIndex,t=this.swiper.slides[e];t.querySelector("a")?.click()}}isVideo(e){return"video"===e.getAttribute("data-zoom-gallery-trigger")}}class h{constructor(e){e=e||{},this.gallery=e.gallery,this.moduleName="productGallery",this.templateType=this.gallery.getAttribute("data-template-type"),this.moduleOptions=s.hv.getOpts(this.moduleName,this.templateType),this.isSlideshow=this.moduleOptions.slideshow,this.isThumbnailsSlideshow=this.moduleOptions.thumbnails_slideshow,this.hasInnerZoom=this.moduleOptions.inner_zoom,this.hasZoomGallery=this.moduleOptions.zoom,this.waitForImageLoad=void 0!==e.waitForImageLoad?e.waitForImageLoad:this.moduleOptions.wait_for_image_load||!1}init(){if(this.setModuleMethods(),this.isThumbnailsSlideshow&&this.handleThumbnailsSlideshow(),this.isSlideshow&&this.handleSlideshow(),this.hasInnerZoom){new o({gallery:this.gallery,mouseWheelZoom:this.moduleOptions.inner_zoom_mousewheelzoom,showZoomLevel:this.moduleOptions.inner_zoom_show_zoomlevel,zoomFactorControls:this.moduleOptions.inner_zoom_factor_controls,zoomFactor:this.moduleOptions.inner_zoom_default_zoom_factor,minZoomFactor:this.moduleOptions.inner_zoom_min_zoom_factor,maxZoomFactor:this.moduleOptions.inner_zoom_max_zoom_factor}).init()}if(this.hasZoomGallery){new a({gallery:this.gallery,gallerySlideshow:this.gallery.querySelector("[data-product-gallery-slideshow]"),slideshowOptions:s.hv.modules[this.moduleName].getSlideshowOpts(this.moduleOptions)}).init()}}setModuleMethods(){s.hv.modules[this.moduleName]={getSlideshowOpts:e=>{let t={};const i=e.slideshow_responsive_options;if(i)for(const[e,s]of Object.entries(i).reverse()){const i={};for(const[e,t]of Object.entries(s))i[e]=t;t[e]=i}return{speed:e.slideshow_speed,loop:e.slideshow_infinite,pagination:{enabled:e.slideshow_dots,clickable:e.slideshow_dots_clickable},scrollbar:{enabled:e.slideshow_scrollbar},direction:e.slideshow_vertical?"vertical":"horizontal",autoHeight:!1,autoplay:{enabled:e.slideshow_autoplay,delay:e.slideshow_autoplay_speed},effect:e.slideshow_fade?"fade":"slide",fadeEffect:{crossFade:!0},navigation:{enabled:e.slideshow_arrows},breakpoints:t}},getThumbnailSlideshowOpts:e=>{const t=Object.keys(e.thumbnails_slideshow_items)[0];let i={};for(const[t,s]of Object.entries(e.thumbnails_slideshow_items).reverse())i[t]={slidesPerView:parseInt(s)};return{slidesPerView:e.thumbnails_slideshow_items[t],loop:e.thumbnails_slideshow_infinite,pagination:{enabled:e.thumbnails_slideshow_dots},scrollbar:{enabled:!1},spaceBetween:e.thumbnails_slideshow_space_between,direction:e.thumbnails_slideshow_vertical?"vertical":"horizontal",autoHeight:!1,speed:e.thumbnails_slideshow_speed,breakpoints:i}}}}handleSlideshow(){const e=this.gallery.querySelector("[data-product-gallery-slideshow]");if(e){const t=s.hv.modules[this.moduleName].getSlideshowOpts(this.moduleOptions);if(this.waitForImageLoad){const i=new Image;i.src=e.querySelector("img").src,i.onload=()=>{this.createSlideshow(e,t)},setTimeout(()=>{e.classList.contains("swiper-initialized")||this.createSlideshow(e,t)},5e3)}else this.createSlideshow(e,t)}}async createSlideshow(e,t){const i=e;let s;if(this.thumbnailSwiper){const e=await this.thumbnailSwiper;t.thumbs={swiper:e},s=await(0,l.N)(i,t)}else s=await(0,l.N)(i,t);
1this.moduleOptions.videos&&s&&s.slides.forEach((e,t)=>{const i=e.classList.contains("swiper-slide-video"),o=s.pagination.bullets[t];i&&o&&(o.classList.add("has-video"),o.setAttribute("data-label","Video"))})}handleThumbnailsSlideshow(){const e=this.gallery.querySelector("[data-product-gallery-thumbnail-slideshow]"),t=s.hv.modules[this.moduleName].getThumbnailSlideshowOpts(this.moduleOptions);this.thumbnailSwiper=(0,l.N)(e,t)}}const n=()=>{const e=document.querySelectorAll("[data-product-gallery]");if(e.length>0){const t={rootMargin:"0px 0px 200px 0px",threshold:.1},i=(e,t)=>{e.forEach(e=>{if(e.intersectionRatio>0){const i=e.target;new h({gallery:i}).init(),t.unobserve(i)}})};for(const s of e){new IntersectionObserver(i,t).observe(s)}}}}}]);

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.