PageSourceSearch

https://isaactheatreroyal.co.nz/hubfs/hub_generated/template_asset…/1790808346741/template_child.min.js

js isaactheatreroyal.co.nz collected 2026-10-02 11:22:56 UTC 3,276 bytes, 2 lines download raw bytes

1document.addEventListener("DOMContentLoaded",function(){const carousels=document.querySelectorAll(".custom-visual-cards.carousel");carousels.forEach(carousel=>{!function(carousel){const container=carousel.querySelector(".custom-visual-cards__container"),prevBtn=carousel.querySelector(".custom-visual-cards__nav--prev"),nextBtn=carousel.querySelector(".custom-visual-cards__nav--next"),dots=carousel.querySelectorAll(".custom-visual-cards__dot");let currentSlide=0;const totalSlides=dots.length;let cardWidth=320,visibleCards=1;function updateCarouselSettings(){const containerWidth=carousel.offsetWidth,cards=container.querySelectorAll(".custom-visual-card");if(cards.length>0){const firstCard=cards[0],computedStyle=window.getComputedStyle(firstCard),cardMargin=parseInt(computedStyle.marginRight)||20;window.innerWidth>1200?(cardWidth=(containerWidth-2*cardMargin)/3.5,visibleCards=Math.min(3,totalSlides)):window.innerWidth>768?(cardWidth=(containerWidth-cardMargin)/2.25,visibleCards=Math.min(2,totalSlides)):(cardWidth=(containerWidth-40)/1.05,visibleCards=1)}}function updateCarousel(){const actualCardWidth=getActualCardWidth(),containerWidth=carousel.offsetWidth,totalWidth=container.querySelector(".custom-visual-card").offsetWidth*visibleCards+20*(visibleCards-1),translateX=-currentSlide*actualCardWidth+(containerWidth-totalWidth)/2;container.style.transform=`translateX(${translateX}px)`,dots.forEach((dot,index)=>{dot.classList.toggle("active",index===currentSlide)}),prevBtn.style.opacity=0===currentSlide?"0":"1",nextBtn.style.opacity=currentSlide>=totalSlides-visibleCards?"0":"1"}function goToSlide(slideIndex){currentSlide=Math.max(0,Math.min(slideIndex,totalSlides-1)),updateCarousel()}function nextSlide(){currentSlide<totalSlides-visibleCards&&(currentSlide++,updateCarousel())}function prevSlide(){currentSlide>0&&(currentSlide--,updateCarousel())}function getActualCardWidth(){const firstCard=container.querySelector(".custom-visual-card");if(firstCard){const style=window.getComputedStyle(firstCard);return firstCard.offsetWidth+parseInt(style.marginRight)}return cardWidth}nextBtn.addEventListener("click",nextSlide),prevBtn.addEventListener("click",prevSlide),dots.forEach((dot,index)=>{dot.addEventListener("click",()=>{goToSlide(index)})});let startX=0,isDragging=!1;function init(){updateCarouselSettings(),updateCarousel()}container.addEventListener("mousedown",e=>{startX=e.clientX,isDragging=!0,container.style.cursor="grabbing"}),container.addEventListener("mousemove",e=>{isDragging&&e.preventDefault()}),container.addEventListener("mouseup",e=>{if(!isDragging)return;isDragging=!1,container.style.cursor="grab";const diffX=startX-e.clientX;Math.abs(diffX)>50&&(diffX>0?nextSlide():prevSlide())}),container.addEventListener("touchstart",e=>{startX=e.touches[0].clientX}),container.addEventListener("touchend",e=>{const diffX=startX-e.changedTouches[0].clientX;Math.abs(diffX)>50&&(diffX>0?nextSlide():prevSlide())}),carousel._carouselInit=init,init()}(carousel)}),window.addEventListener("resize",()=>{carousels.forEach(carousel=>{carousel._carouselInit&&carousel._carouselInit()})})});
2//# sourceURL=https://44484570.fs1.hubspotusercontent-na1.net/hubfs/44484570/hub_generated/template_assets/1/182592239010/1790808346741/template_child.js

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.