PageSourceSearch

https://frameworth.com/cdn/shop/t/157/assets/slideshow.js?v=108386117842859614801787608033

js frameworth.com collected 2026-09-26 11:40:40 UTC 12,386 bytes, 2 lines download raw bytes

1if(!customElements.get("slide-show")){class SlideShow extends HTMLElement{constructor(){super(),this.dataset.hasSchedule==="true"?this.initTimeoutId=setTimeout(this.init.bind(this),0):window.initLazyScript(this,this.init.bind(this))}init(){this.initialized||(this.initialized=!0,this.slideshow=this.querySelector(".slideshow"),this.allSlides=Array.from(this.querySelectorAll(".slideshow__slide")),this.nav=this.querySelector(".slideshow-nav"),this.controls=this.querySelector(".slideshow-ctrl"),this.pagination=this.querySelector(".slideshow-pagination"),this.allPageBtns=Array.from(this.querySelectorAll(".page-btn")),this.rtl=document.dir==="rtl",this.currentIndex=0,this.swipeThreshold=80,this.wheelTriggerWait=800,this.loadSlideLabel=this.dataset.loadSlideLabel||"",this.ofLabel=this.dataset.ofLabel||"",this.nav&&(this.counterCurrent=this.querySelector(".slideshow-nav__counter-current"),this.counterTotal=this.querySelector(".slideshow-nav__counter-total"),this.nav.addEventListener("click",this.handleNavClick.bind(this))),this.pagination&&this.pagination.addEventListener("click",this.handlePaginationClick.bind(this)),theme.device.hasTouch&&(this.slideshow.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!0}),this.slideshow.addEventListener("touchmove",debounce(this.handleTouchMove.bind(this),200),{passive:!0})),this.slideshow.addEventListener("wheel",this.handleWheel.bind(this),{passive:!0}),this.slideshow.addEventListener("transitionend",SlideShow.handleTransitionend),this.syncScheduledSlides(),this.initSlideSchedule(),this.dataset.autoplay==="true"&&this.initAutoPlay())}disconnectedCallback(){clearTimeout(this.initTimeoutId),clearTimeout(this.autoplayTimer),clearTimeout(this.setActiveSlideTimeoutId),clearInterval(this.scheduleTimer),this.visibilityChangeHandler&&document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.pageShowHandler&&window.removeEventListener("pageshow",this.pageShowHandler)}initAutoPlay(){this.autoplayEnabled=!0,this.autoplaySpeed=this.dataset.speed*1e3,this.addEventListener("mouseover",this.pauseAutoplay.bind(this)),this.addEventListener("mouseleave",this.resumeAutoplay.bind(this)),this.slideshow.addEventListener("focusin",this.pauseAutoplay.bind(this)),this.slideshow.addEventListener("focusout",this.resumeAutoplay.bind(this)),this.addObserver(),this.slides.length>1&&this.startAutoplay()}handleNavClick(evt){if(evt.target.matches(".autoplay-btn")){this.togglePlayState(evt);return}evt.target.name==="next"?this.showNextSlide():evt.target.name==="prev"&&this.showPrevSlide()}handlePaginationClick(evt){evt.target.matches(".page-btn")&&(this.slides.length<2||(this.autoplayTimeLeft=this.autoplaySpeed,this.setActiveSlide(Number(evt.target.dataset.index))))}handleWheel(evt){this.blockWheelTrigger?evt.preventDefault():evt.deltaX>20?(evt.preventDefault(),this.showNextSlide(),this.blockWheelTrigger=!0,setTimeout(()=>{this.blockWheelTrigger=!1},this.wheelTriggerWait)):evt.deltaX<-20&&(evt.preventDefault(),this.showPrevSlide(),this.blockWheelTrigger=!0,setTimeout(()=>{this.blockWheelTrigger=!1},this.wheelTriggerWait))}handleTouchStart(evt){this.touchStart=evt.changedTouches[0].screenX}handleTouchMove(evt){const touchEnd=evt.changedTouches[0].screenX;touchEnd<this.touchStart-this.swipeThreshold&&(this.rtl?this.showPrevSlide():this.showNextSlide()),touchEnd>this.touchStart+this.swipeThreshold&&(this.rtl?this.showNextSlide():this.showPrevSlide())}static handleTransitionend(evt){evt.target.matches(".has-motion")&&evt.target.classList.remove("transition-out")}showNextSlide(){if(this.slides.length<2)return;let index=this.currentIndex+1;index===this.slides.length&&(index=0),this.setActiveSlide(index,"next")}showPrevSlide(){if(this.slides.length<2)return;let index=this.currentIndex-1;index<0&&(index=this.slides.length-1),this.setActiveSlide(index,"prev")}setActiveSlide(slideIndex,slideDirection){if(this.slides.length<2||slideIndex<0||slideIndex>=this.slides.length||slideIndex===this.currentIndex)return;clearTimeout(this.setActiveSlideTimeoutId),clearTimeout(this.autoplayTimer);let dir=slideDirection||(slideIndex<this.currentIndex?"prev":"next");this.rtl&&(dir=dir==="next"?"prev":"next"),this.dataset.direction=dir,this.slides[this.currentIndex].classList.add("transition-out"),this.setActiveSlideTimeoutId=setTimeout(()=>{this.slideshow.scrollTo({left:this.slides[slideIndex].offsetLeft,behavior:"auto"}),this.slides[slideIndex].classList.add("is-active"),this.slides[this.currentIndex].classList.remove("is-active","transition-out");const transitionedEl=this.slides[this.currentIndex].querySelector(".has-motion");transitionedEl&&transitionedEl.classList.add("transition-out"),this.autoplayEnabled&&(this.autoplayStartTime=Date.now()),this.counterCurrent&&(this.counterCurrent.textContent=slideIndex+1),this.counterTotal&&(this.counterTotal.textContent=this.slides.length),this.currentIndex=sli
1deIndex,this.setSlideVisibility(),this.updatePagination(),this.autoplayEnabled&&!this.autoplayPaused&&(this.autoplayTimeLeft=this.autoplaySpeed,this.autoplayTimer=setTimeout(this.showNextSlide.bind(this),this.autoplaySpeed))},200)}updatePagination(){this.pagination&&this.pageBtns.forEach((el,index)=>{index===this.currentIndex?el.setAttribute("aria-current","true"):el.removeAttribute("aria-current")})}initSlideSchedule(){this.allSlides.some(slide=>slide.dataset.scheduleEnabled==="true"&&(slide.dataset.scheduleStart||slide.dataset.scheduleEnd))&&(this.visibilityChangeHandler=()=>{document.visibilityState==="visible"&&this.syncScheduledSlides()},this.pageShowHandler=this.syncScheduledSlides.bind(this),document.addEventListener("visibilitychange",this.visibilityChangeHandler),window.addEventListener("pageshow",this.pageShowHandler),clearInterval(this.scheduleTimer),this.scheduleTimer=setInterval(this.syncScheduledSlides.bind(this),1e3))}static parseScheduleBoundary(value){if(!value)return null;const timestamp=Number(value);return Number.isFinite(timestamp)&&timestamp>0?timestamp*1e3:Number.NaN}static isScheduleWindowActive(startValue,endValue,now=Date.now()){const start=SlideShow.parseScheduleBoundary(startValue),end=SlideShow.parseScheduleBoundary(endValue);return!(Number.isNaN(start)||Number.isNaN(end)||start!==null&&end!==null&&end<=start||start!==null&&now<start||end!==null&&now>=end)}isSlideScheduled(slide,now=Date.now()){return this.editorPreviewSlide===slide||slide.dataset.scheduleEnabled!=="true"?!0:SlideShow.isScheduleWindowActive(slide.dataset.scheduleStart,slide.dataset.scheduleEnd,now)}syncScheduledSlides(){const previousSlides=this.slides||[],previousActiveSlide=previousSlides[this.currentIndex],previousIndex=this.currentIndex,now=Date.now();let visibilityChanged=!this.slides;if(this.allSlides.forEach((slide,index)=>{const shouldHide=!this.isSlideScheduled(slide,now);slide.hidden!==shouldHide&&(visibilityChanged=!0),slide.hidden=shouldHide,this.allPageBtns[index]&&(this.allPageBtns[index].hidden=shouldHide),shouldHide&&(slide.classList.remove("is-active","transition-out"),slide.setAttribute("aria-hidden","true"),slide.setAttribute("tabindex","-1"),slide.querySelectorAll("a").forEach(link=>link.setAttribute("tabindex","-1")))}),!visibilityChanged)return!1;if(clearTimeout(this.setActiveSlideTimeoutId),this.refreshSlides(),!this.slides.length)return this.currentIndex=0,this.hideSlideshow(),!0;this.showSlideshow();const retainedActiveIndex=previousActiveSlide?this.slides.indexOf(previousActiveSlide):-1;if(retainedActiveIndex>=0)this.currentIndex=retainedActiveIndex;else if(previousSlides.length)this.currentIndex=Math.min(previousIndex,this.slides.length-1);else{const initialActiveIndex=this.slides.findIndex(slide=>slide.classList.contains("is-active"));this.currentIndex=initialActiveIndex>=0?initialActiveIndex:0}return this.activateCurrentSlide(),this.autoplayEnabled&&this.slides.length>1&&this.isInViewport!==!1&&!this.matches(":hover")&&!this.slideshow.matches(":focus-within")&&this.startAutoplay(),!0}previewSlideInEditor(slide){if(this.initialized||this.init(),!this.allSlides.includes(slide))return;this.editorPreviewSlide=slide,this.syncScheduledSlides();const previewIndex=this.slides.indexOf(slide);previewIndex<0||(this.currentIndex=previewIndex,this.activateCurrentSlide())}restoreSlideScheduleInEditor(slide){!this.initialized||this.editorPreviewSlide!==slide||(this.editorPreviewSlide=null,this.syncScheduledSlides())}refreshSlides(){this.slides=this.allSlides.filter(slide=>!slide.hidden),this.pageBtns=this.allPageBtns.filter(button=>!button.hidden),this.currentIndex=Math.min(this.currentIndex,Math.max(this.slides.length-1,0)),this.slides.forEach((slide,index)=>{slide.dataset.index=String(index),this.ofLabel&&slide.setAttribute("aria-label",`${index+1} ${this.ofLabel} ${this.slides.length}`)}),this.pageBtns.forEach((button,index)=>{button.dataset.index=String(index);const label=button.querySelector("[data-page-btn-label]");label&&this.loadSlideLabel&&this.ofLabel&&(label.textContent=`${this.loadSlideLabel} ${index+1} ${this.ofLabel} ${this.slides.length}`)}),this.counterTotal&&(this.counterTotal.textContent=this.slides.length),this.syncControls()}
1activateCurrentSlide(){this.slides.forEach((slide,index)=>{slide.classList.remove("transition-out"),slide.classList.toggle("is-active",index===this.currentIndex)}),this.slideshow.scrollTo({left:this.slides[this.currentIndex].offsetLeft,behavior:"auto"}),this.counterCurrent&&(this.counterCurrent.textContent=this.currentIndex+1),this.setSlideVisibility(),this.updatePagination()}syncControls(){const hasMultipleSlides=this.slides.length>1;this.controls&&(this.controls.hidden=!hasMultipleSlides),this.pagination&&(this.pagination.hidden=!hasMultipleSlides),this.nav&&(this.nav.hidden=!hasMultipleSlides),this.querySelectorAll(".slideshow-nav__btn, .page-btn").forEach(button=>{button.disabled=!hasMultipleSlides}),hasMultipleSlides||this.stopAutoplay()}hideSlideshow(){clearTimeout(this.autoplayTimer),clearTimeout(this.setActiveSlideTimeoutId),this.hidden=!0,this.setAttribute("aria-hidden","true"),this.closest(".slideshow-section")?.setAttribute("hidden","")}showSlideshow(){this.hidden=!1,this.removeAttribute("aria-hidden"),this.closest(".slideshow-section")?.removeAttribute("hidden")}stopAutoplay(){this.setSlideshowState("paused"),clearTimeout(this.autoplayTimer)}startAutoplay(){this.slides.length<2||(this.autoplayTimeLeft=null,this.autoplayStartTime=Date.now(),clearTimeout(this.autoplayTimer),this.autoplayTimer=setTimeout(this.showNextSlide.bind(this),this.autoplaySpeed),this.setSlideshowState("running"))}pauseAutoplay(){this.slides.length<2||!this.autoplayEnabled||this.autoplayPaused||(this.stopAutoplay(),this.autoplayTimeLeft?this.autoplayTimeLeft-=Date.now()-this.resumedTime:this.autoplayTimeLeft=this.autoplaySpeed-(Date.now()-this.autoplayStartTime))}resumeAutoplay(){if(this.slides.length<2||!this.autoplayEnabled||!this.autoplayPaused)return;this.resumedTime=Date.now();const resumeDelay=Number.isFinite(this.autoplayTimeLeft)&&this.autoplayTimeLeft>0?this.autoplayTimeLeft:this.autoplaySpeed;this.autoplayTimeLeft=resumeDelay,this.autoplayTimer=setTimeout(this.showNextSlide.bind(this),resumeDelay),this.setSlideshowState("running")}addObserver(){if(!("IntersectionObserver"in window))return;new IntersectionObserver(entries=>{entries.forEach(entry=>{this.isInViewport=entry.isIntersecting,entry.isIntersecting?this.resumeAutoplay():this.pauseAutoplay()})}).observe(this)}setSlideVisibility(){this.slides.forEach((el,index)=>{const btns=el.querySelectorAll("a");index===this.currentIndex?(el.setAttribute("aria-hidden","false"),el.removeAttribute("tabindex"),btns.forEach(btn=>{btn.removeAttribute("tabindex")})):(el.setAttribute("aria-hidden","true"),el.setAttribute("tabindex","-1"),btns.forEach(btn=>{btn.setAttribute("tabindex","-1")}))})}setSlideshowState(state){this.style.setProperty("--play-state",state),this.slideshow.setAttribute("aria-live",state==="running"?"off":"polite"),this.autoplayPaused=state==="paused"}togglePlayState(evt){this.slides.length<2||(evt.target.classList.toggle("is-paused"),this.autoplayEnabled=!this.autoplayEnabled,this.dataset.autoplay=this.autoplayEnabled?"true":"false",this.autoplayEnabled?this.startAutoplay():this.stopAutoplay())}}customElements.define("slide-show",SlideShow)}
2//# sourceMappingURL=/cdn/shop/t/157/assets/slideshow.js.map?v=108386117842859614801787608033

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.