1/** 2 * Initializes Swiper for every review slider on the page. 3 * The HTML is already present server-side â Swiper only enhances the display. 4 */ 5( function () { 6 'use strict'; 7 8 function initSliders() { 9 if ( typeof window.Swiper === 'undefined' ) { 10 return; 11 } 12 13 var sliders = document.querySelectorAll( '.onesty-reviews-swiper' ); 14 15 sliders.forEach( function ( node ) { 16 if ( node.dataset.onestyInit === '1' ) { 17 return; 18 } 19 node.dataset.onestyInit = '1'; 20 21 var perView = parseInt( node.getAttribute( 'data-per-view' ), 10 ) || 3; 22 var autoplay = node.getAttribute( 'data-autoplay' ) === '1'; 23 24 var config = { 25 slidesPerView: 1, 26 spaceBetween: 20, 27 watchOverflow: true, 28 a11y: { enabled: true }, 29 pagination: { 30 el: node.querySelector( '.swiper-pagination' ), 31 clickable: true 32 }, 33 navigation: { 34 prevEl: node.querySelector( '.swiper-button-prev' ), 35 nextEl: node.querySelector( '.swiper-button-next' ) 36 }, 37 breakpoints: { 38 640: { slidesPerView: Math.min( 2, perView ) }, 39 1024: { slidesPerView: perView } 40 } 41 }; 42 43 if ( autoplay ) { 44 config.autoplay = { delay: 5000, disableOnInteraction: false, pauseOnMouseEnter: true }; 45 config.loop = true; 46 } 47 48 // eslint-disable-next-line no-new 49 new window.Swiper( node, config ); 50 } ); 51 } 52 53 if ( document.readyState === 'loading' ) { 54 document.addEventListener( 'DOMContentLoaded', initSliders ); 55 } else { 56 initSliders(); 57 } 58} )();
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.