PageSourceSearch

https://drink-mission.com/cdn/shop/t/214/assets/counter.js?v=162872045343541196461787119878

js drink-mission.com collected 2026-10-07 14:41:43 UTC 3,742 bytes, 2 lines download raw bytes

1export function setupCounter(carousel,options){const instance=carousel.swiperInstance;if(!instance||!Object.prototype.hasOwnProperty.call(options||{},"counter"))return;if(!options.counter){const maybeEl=carousel.querySelector('[ref="counter"]');maybeEl&&maybeEl.classList.add("hidden");return}let counterEl=null;if(options?.counter?.el instanceof HTMLElement?counterEl=options.counter.el:counterEl=carousel.querySelector('[ref="counter"]'),!counterEl)return;counterEl.classList.remove("hidden");const counterFormat=(options?.counter&&typeof options.counter.format=="string"?options.counter.format:carousel.counterFormat)||"{current} / {total}",render=()=>renderCounter(carousel,counterEl,counterFormat);render(),instance.on("slideChange",render),instance.on("slidesLengthChange",render),instance.on("update",render);let breakpointRenderTimeout=null;instance.on("breakpoint",()=>{breakpointRenderTimeout&&clearTimeout(breakpointRenderTimeout),breakpointRenderTimeout=setTimeout(()=>{requestAnimationFrame(()=>{render(),breakpointRenderTimeout=null})},150)});let resizeRenderTimeout=null;instance.on("resize",()=>{resizeRenderTimeout&&clearTimeout(resizeRenderTimeout),resizeRenderTimeout=setTimeout(()=>{requestAnimationFrame(()=>{render(),resizeRenderTimeout=null})},150)}),instance.on("setTranslate",render)}function renderCounter(carousel,el,format){const instance=carousel.swiperInstance;if(!instance)return;const slides=Array.from(instance.slides||[]),total=slides.filter(s=>!s.classList.contains("swiper-slide-duplicate")).length;let currentIndex=typeof instance.realIndex=="number"?instance.realIndex:typeof instance.activeIndex=="number"?instance.activeIndex:0;const params=instance.params||{},slidesPerView=params.slidesPerView,isDecimalSlidesPerView=typeof slidesPerView=="number"&&slidesPerView%1!==0;if(params.slidesPerView==="auto"){const maxTranslate=instance.virtualSize-instance.size;Math.abs(instance.translate||0)>=maxTranslate-1&&(currentIndex=total-1)}else if(isDecimalSlidesPerView){const snapGrid=instance.snapGrid||[],slidesGrid=instance.slidesGrid||[],currentTranslate=Math.abs(instance.translate||0);if(snapGrid.length>0&&slidesGrid.length>0){let closestSnapIndex=0,closestDistance=1/0;for(let i=0;i<snapGrid.length;i++){const snapTranslate2=Math.abs(snapGrid[i]),distance=Math.abs(currentTranslate-snapTranslate2);distance<closestDistance&&(closestDistance=distance,closestSnapIndex=i)}const snapTranslate=Math.abs(snapGrid[closestSnapIndex]);
1let foundSlide=!1;for(let i=0;i<slidesGrid.length;i++){const slideStart=Math.abs(slidesGrid[i]);if(Math.abs(slideStart-snapTranslate)<1){currentIndex=i,foundSlide=!0;break}}if(!foundSlide)for(let i=0;i<slidesGrid.length-1;i++){const slideStart=Math.abs(slidesGrid[i]),slideEnd=Math.abs(slidesGrid[i+1]);if(snapTranslate>=slideStart&&snapTranslate<slideEnd){currentIndex=i,foundSlide=!0;break}}if(!foundSlide){let closestSlideIndex=0,closestSlideDistance=1/0;for(let i=0;i<slidesGrid.length;i++){const slideStart=Math.abs(slidesGrid[i]),distance=Math.abs(slideStart-snapTranslate);distance<closestSlideDistance&&(closestSlideDistance=distance,closestSlideIndex=i)}currentIndex=closestSlideIndex}}else snapGrid.length>0&&(currentIndex=Math.min(snapGrid.findIndex(snap=>Math.abs(Math.abs(snap)-currentTranslate)<1)||0,total-1));currentIndex=Math.max(0,Math.min(currentIndex,total-1));const maxTranslate=instance.maxTranslate?Math.abs(instance.maxTranslate()):0;maxTranslate>0&&currentTranslate>=maxTranslate-10&&(currentIndex=total-1)}const current=currentIndex+1,text=format.replace("{current}",String(current)).replace("{total}",String(total||slides.length||0));el.textContent=text}
2//# sourceMappingURL=/cdn/shop/t/214/assets/counter.js.map?v=162872045343541196461787119878

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.