1var initHeroSimple = async () => { 2 if (typeof Swiper != 'function' && window.innerWidth > 767) { 3 await lazy.loadScript('/res/js/swiper/swiper-bundle.min.js') 4 lazy.loadScript('/res/js/swiper/swiper-bundle.css') 5 } 6 7 sliderHeroSimple() 8} 9 10function sliderHeroSimple() { 11 if(window.innerWidth > 767) { 12 document.querySelectorAll('.hero-simple-swiper').forEach(slide => { 13 const opt = { 14 loop: true, 15 lazy: true, 16 autoplay: parseInt(slide.dataset.autoplay) > 0 ? { delay : parseInt(slide.dataset.autoplay) } : false, 17 speed: 600, 18 effect: 'slide', 19 navigation: { 20 prevEl: slide.parentNode.querySelector('.button-prev'), 21 nextEl: slide.parentNode.querySelector('.button-next'), 22 }, 23 pagination: { 24 el: slide.dataset.pagination || slide.querySelector('.pagination'), 25 clickable: true, 26 }, 27 on: { 28 slideChange: function() { 29 const swiper = this 30 const index = swiper.activeIndex 31 const slide = swiper.slides[index] 32 33 const img = slide.querySelector('img[swiperjs-src]') 34 if (img) { 35 img.src = img.getAttribute('swiperjs-src') 36 img.removeAttribute('swiperjs-src') 37 38 img.srcset = img.getAttribute('swiperjs-srcset') 39 img.removeAttribute('swiperjs-srcset') 40 } 41 42 slide.querySelectorAll('source[swiperjs-srcset]').forEach(source => { 43 source.srcset = source.getAttribute('swiperjs-srcset') 44 source.removeAttribute('swiperjs-srcset') 45 }) 46 } 47 } 48 } 49 50 new Swiper(slide, opt) 51 }) 52 } else { 53 // on affiche le premier slide et on cache les autres 54 document.querySelectorAll('.hero-simple-swiper').forEach(hero => { 55 hero.querySelectorAll('.swiper-slide:not(:first-child)').forEach(sli
55de => slide.remove()) 56 57 // get parent then pagination child and remove it 58 hero.parentNode.querySelector('.pagination')?.remove() 59 60 // remove swiper-wrapper class 61 hero.classList.remove('swiper') 62 }) 63 } 64}
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.