1(() => { 2 const carousel = document.querySelector('.pc-carousel'); 3 if (!carousel) return; 4 5 const pages = carousel.querySelectorAll('.pc-grid--page'); 6 const prevBtns = carousel.querySelectorAll('.pc-carousel__arrow--prev'); 7 const nextBtns = carousel.querySelectorAll('.pc-carousel__arrow--next'); 8 const dots = carousel.querySelectorAll('.pc-carousel__dot'); 9 let current = 0; 10 11 function goTo(index) { 12 if (index < 0 || index >= pages.length) return; 13 pages[current].classList.remove('is-active'); 14 current = index; 15 pages[current].classList.add('is-active'); 16 dots.forEach((dot) => { 17 dot.classList.toggle('is-active', Number(dot.dataset.page) === current); 18 }); 19 prevBtns.forEach((btn) => { btn.disabled = current === 0; }); 20 nextBtns.forEach((btn) => { btn.disabled = current === pages.length - 1; }); 21 } 22 23 prevBtns.forEach((btn) => { btn.addEventListener('click', () => goTo(current - 1)); }); 24 nextBtns.forEach((btn) => { btn.addEventListener('click', () => goTo(current + 1)); }); 25 dots.forEach((dot) => { 26 dot.addEventListener('click', () => goTo(Number(dot.dataset.page))); 27 }); 28})();
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.