PageSourceSearch

https://www.space.com/vite/assets/Flexi/Widgets/Carouzelize.ts-BQCnpvGa.js

js space.com collected 2026-09-24 07:17:20 UTC 2,975 bytes, 1 lines download raw bytes

1document.addEventListener("alpine:init",(()=>{Alpine.data("carouzelize",(()=>({activeInd:0,offset:0,totalItems:0,containerRef:null,previousControl:null,nextControl:null,timeId:null,initialized:!1,init(){if(null===this.$el.offsetParent||"none"===window.getComputedStyle(this.$el).display||"hidden"===window.getComputedStyle(this.$el).visibility||this.initialized)return;this.initialized=!0,this.containerRef=this.$el.querySelector(".wdn-listv2-item-lists"),this.previousControl=this.$el.querySelector(".previous"),this.nextControl=this.$el.querySelector(".next"),this.totalItems=this.containerRef.querySelectorAll(".wdn-listv2-item").length,this.activeInd=0,this.offset=0;const t=this.containerRef.offsetWidth;this.containerRef.querySelectorAll(".wdn-listv2-item").forEach((i=>{i.offsetLeft+i.offsetWidth<=t&&this.offset++})),this.checkControls(),this.previousControl.addEventListener("click",(()=>{this.previous(),this.checkControls()})),this.nextControl.addEventListener("click",(()=>{this.next(),this.checkControls()})),window.addEventListener("resize",(()=>{this.timeId&&clearTimeout(this.timeId),this.timeId=window.setTimeout((()=>this.reload()),500)}))},next(){if(this.activeInd<this.totalItems-this.offset){let t=this.activeInd+this.offset;t=t>this.totalItems?this.totalItems-1:t,this.containerRef.children[t].scrollIntoView({behavior:"smooth",inline:"start",block:"nearest"}),this.activeInd=t}},previous(){if(this.activeInd>0){let t=this.activeInd-this.offset;t=t<0?0:t,this.containerRef.children[t].scrollIntoView({behavior:"smooth",inline:"start",block:"nearest"}),this.activeInd=t}},checkControls(){const t=this.containerRef.offsetWidth,i=this.containerRef.querySelectorAll(".wdn-listv2-item")[this.totalItems-1];if(!(i&&i.offsetLeft+i.offsetWidth>t)&&this.offset>=this.totalItems)return this.nextControl.style.display="none",this.nextControl.style.visibility="hidden",this.previousControl.style.display="none",void(this.previousControl.style.visibility="hidden");this.activeInd>=this.totalItems-this.offset?(this.nextControl.style.display="none",this.nextControl.style.visibility="hidden"):(this.nextControl.style.display="block",this.nextControl.style.visibility="visible"),this.activeInd<=0?(this.previousControl.style.display="none",this.previousControl.style.visibility="hidden"):(this.previousControl.style.display="block",this.previousControl.style.visibility="visible")},reload(){if(!this.isInViewport(this.containerRef))return;this.activeInd=0,this.offset=0,this.containerRef.children[0].scrollIntoView({behavior:"smooth",inline:"start",block:"nearest"});const t=this.containerRef.offsetWidth;this.containerRef.querySelectorAll(".wdn-listv2-item").forEach((i=>{i.offsetLeft+i.offsetWidth<=t&&this.offset++})),this.checkControls()},isInViewport(t){const i=t.getBoundingClientRect();return i.top>=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth)}})))}));

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.