PageSourceSearch

https://spenceltd.co.uk/wp-content/themes/spence/dist/js/block_swi…rds-swiper-cards-js.7e8ee551bb24cdaeec0e.js

js spenceltd.co.uk collected 2026-10-02 19:41:10 UTC 6,429 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkcdrs_wp_theme=self.webpackChunkcdrs_wp_theme||[]).push([[2354],{3132:function(e,i,t){t.r(i);var s=t(6404),o=t(2112),r=t(8352);i.default={debug:!1,swiper:null,lenis:null,scrollTriggers:[],desktopScrollTriggers:[],isDesktop:!1,mount(){this.log("<c-swiper-cards> has mounted"),this.handleResize=this.handleResize.bind(this),window.utils&&window.utils.lenis?this.lenis=window.utils.lenis.main():(this.log("Lenis not available, skipping Lenis initialization","warn"),this.lenis={scroll:0,scrollTo:()=>{},on:()=>{},raf:()=>{}}),this.lenis&&this.lenis.scrollTo&&(s.os.registerPlugin(s.uY),s.uY.scrollerProxy(document.documentElement,{scrollTop:e=>(arguments.length&&this.lenis.scrollTo(e,{immediate:!0}),this.lenis.scroll),getBoundingClientRect:()=>({top:0,left:0,width:window.innerWidth,height:window.innerHeight})}),this.lenis.on("scroll",s.uY.update),s.os.ticker.add((e=>this.lenis.raf(1e3*e))),s.os.ticker.lagSmoothing(0,0)),window.addEventListener("resize",this.handleResize),this.handleResize(),this.comp.$(".js-video-background")&&Promise.all([t.e(9117),t.e(696)]).then(t.bind(t,696)).then((({default:e})=>{this.videoHandler=new e(this.comp,{debug:this.debug}),this.log("Video detected, handler initialized")})).catch((e=>{this.log("Failed to load video background:","warn",e)}))},cleanUp(){this.scrollTriggers.forEach((e=>e.kill())),this.scrollTriggers=[],this.desktopScrollTriggers.forEach((e=>e.kill&&e.kill())),this.desktopScrollTriggers=[],this.comp.querySelectorAll(".swiper-slide.active, .swiper-pagination-bullet.active").forEach((e=>e.classList.remove("active")));const e=this.comp.querySelector(".swiper-cards-wrapper");if(e){s.os.set(e,{clearProps:"all"}),e.style.height="",e.classList.remove("is-desktop");const i=e.parentElement;i&&(i.style.height="")}const i=this.comp.querySelectorAll(".block_media, .background-image, .background-video, img, picture, video");i.length&&s.os.set(i,{clearProps:"all"}),this.swiper&&(this.swiper.destroy(!0,!0),this.swiper=null)},initializeSwiper(){if(this.isDesktop)return;const e=this.ref("swiper"),i=this.ref("pagination");if(!e)return this.log("Swiper element not found","warn");this.log("Initializing Swiper"),this.swiper=new o.A(e,{modules:[r.Jq,r.s3,r.dK,r.Ij],slidesPerView:1,spaceBetween:0,direction:"vertical",loop:!1,speed:800,keyboard:!0,allowTouchMove:!0,simulateTouch:!0,a11y:{enabled:!0},pagination:{clickable:!0,el:i,renderBullet:(e,i)=>`<span class="${i}"></span>`},on:{init:()=>{this.adjustPagination(),s.uY.refresh()},resize:()=>this.adjustPagination()}}),this.log("Swiper initialized successfully")},setupScrollTrigger(){if(!this.isDesktop)return;const e=this.comp.querySelectorAll(".swiper-slide");this.comp.querySelectorAll(".swiper-pagination-bullet");if(!e.length)return;const i=this.comp.querySelectorAll(".background-image, .background-video, img, picture, video, .background-overlay"),t=this.comp.querySelectorAll(".block_media");e.forEach(((o,r)=>{const l=s.uY.create({scroller:document.documentElement,trigger:o,start:"top top",end:r===e.length-1?"bottom bottom":"bottom top",onEnter:()=>{0===r&&t.forEach((e=>{e.style.padding="0px"}
1)),i.forEach((e=>{e.style.borderRadius="0px"}))},onLeaveBack:()=>{0===r&&t.forEach((e=>{e.style.padding="20px"})),i.forEach((e=>{e.style.borderRadius="20px"}))},onLeave:()=>{0===r&&t.forEach((e=>{e.style.padding="20px"})),i.forEach((e=>{e.style.borderRadius="20px"}))},onEnterBack:()=>{0===r&&t.forEach((e=>{e.style.padding="0px"})),i.forEach((e=>{e.style.borderRadius="0px"}))}});this.scrollTriggers.push(l)})),s.uY.refresh()},adjustPagination(){if(this.isDesktop)return;const e=this.ref("pagination");if(!e)return;Object.assign(e.style,{position:"absolute",top:"50%",left:"15px",transform:"translateY(-50%)",display:"flex",flexDirection:"column",gap:"15px",width:"15px",pointerEvents:"none"});e.querySelectorAll(".swiper-pagination-bullet").forEach((e=>{e.style.pointerEvents="auto"}))},setupDesktopLayout(){const e=this.comp.querySelector(".swiper-cards-wrapper"),i=this.comp.querySelectorAll(".swiper-slide"),t=this.comp.querySelector(".swiper-container");e&&t&&(e.style.height="",t.style.height="",i.forEach((e=>{e.style.height="100vh",e.style.marginBottom="0"})))},setupDesktopScrollPinning(){this.desktopScrollTriggers.forEach((e=>e.kill&&e.kill())),this.desktopScrollTriggers=[];const e=this.comp.querySelector(".swiper-cards-wrapper"),i=this.comp.querySelectorAll(".swiper-slide");if(!e||!i.length)return;const t=window.innerHeight,o=i.length,r=t*Math.max(o-1,1);e.style.height="100vh";const l=e.parentElement;if(l){const e=t+r+20;l.style.height=`${e}px`}const n=s.os.timeline({defaults:{ease:"none"},scrollTrigger:{trigger:e,start:"top 84px",end:`+=${r}px`,scrub:!0,pin:!0,markers:this.debug,invalidateOnRefresh:!0,onEnter:()=>{this.comp.querySelectorAll(".block_media").forEach((e=>{e.style.padding="0px"}));this.comp.querySelectorAll(".background-image, .background-video, img, picture, video, .background-overlay").forEach((e=>{e.style.borderRadius="0px"}))},onLeave:()=>{this.comp.querySelectorAll(".block_media").forEach((e=>{e.style.padding="20px"}));this.comp.querySelectorAll(".background-image, .background-video, img, picture, video, .background-overlay").forEach((e=>{e.style.borderRadius="20px"}))},onLeaveBack:()=>{this.comp.querySelectorAll(".block_media").forEach((e=>{e.style.padding="20px"}));this.comp.querySelectorAll(".background-image, .background-video, img, picture, video, .background-overlay").forEach((e=>{e.style.borderRadius="20px"}))},onEnterBack:()=>{this.comp.querySelectorAll(".block_media").forEach((e=>{e.style.padding="0px"}));this.comp.querySelectorAll(".background-image, .background-video, img, picture, video, .background-overlay").forEach((e=>{e.style.borderRadius="0px"}))}}});i.forEach(((e,i)=>{0!==i&&(s.os.set(e,{y:"100vh"}),n.to(e,{y:"0vh",duration:.8},i))})),this.desktopScrollTriggers.push(n.scrollTrigger),s.uY.refresh()},handleResize(){this.cleanUp(),this.isDesktop=window.innerWidth>=768;const e=this.comp.querySelector(".swiper-cards-wrapper");e&&(this.isDesktop?e.classList.add("is-desktop"):e.classList.remove("is-desktop")),this.isDesktop?(this.setupDesktopLayout(),this.setupDesktopScrollPinning()):this.initializeSwiper()},unmount(){this.cleanUp(),this.videoHandler&&(this.videoHandler.destroy(),this.videoHandler=null),window.removeEventListener("resize",this.handleResize),this.log("<c-swiper-cards> has unmounted")}}}}]);

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.