1function initSwiperSlider(el) { 2 if (el.swiperSliderInit) return; 3 el.swiperSliderInit = true; 4 5 new Swiper(el, { 6 slidesPerView: 1, 7 loop: true, 8 9 navigation: { 10 nextEl: el.querySelector('.swiper-button-next'), 11 prevEl: el.querySelector('.swiper-button-prev'), 12 }, 13 14 pagination: { 15 el: el.querySelector('.swiper-pagination'), 16 clickable: true, 17 }, 18 }); 19} 20 21document.addEventListener('DOMContentLoaded', () => { 22 document.querySelectorAll('.swiper.posts-slider').forEach(initSwiperSlider); 23}); 24 25// Gère les insertions dynamiques (ex : ServerSideRender dans l'éditeur Gutenberg) 26new MutationObserver((mutations) => { 27 for (const mutation of mutations) { 28 for (const node of mutation.addedNodes) { 29 if (node.nodeType !== Node.ELEMENT_NODE) continue; 30 if (node.classList.contains('posts-slider')) { 31 initSwiperSlider(node); 32 } 33 node.querySelectorAll('.swiper.posts-slider').forEach(initSwiperSlider); 34 } 35 } 36}).observe(document.documentElement, { childList: true, subtree: true });
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.