1window.addEventListener('load', function () { 2 const allSplideWrappers = document.querySelectorAll('.splide') 3 4 if (allSplideWrappers.length > 0) { 5 const splideMinCss = document.createElement('link') 6 splideMinCss.type = 'text/css' 7 splideMinCss.rel = 'stylesheet' 8 splideMinCss.href = '/splide.min.css' 9 10 const splideMinJs = document.createElement('script') 11 splideMinJs.setAttribute('src', '/splide.min.js') 12 splideMinJs.setAttribute('type', 'text/javascript') 13 14 splideMinJs.onload = () => { 15 allSplideWrappers.forEach((splideWrapper) => { 16 const splideSettings = JSON.parse(splideWrapper.dataset.splide) 17 splideWrapper 18 .querySelectorAll('.splide__list > *') 19 .forEach((splideItem) => splideItem.classList.add('splide__slide')) 20 const splideInstance = new window.Splide(splideWrapper, splideSettings) 21 const bar = splideInstance.root.querySelector('.my-slider-progress-bar') 22 if(bar) { 23 splideInstance.on('mounted move', function () { 24 const end = splideInstance.Components.Controller.getEnd() + 1 25 const rate = Math.min((splideInstance.index + 1) / end, 1) 26 bar.style.width = String(100 * rate) + '%' 27 }) 28 } 29 30 splideInstance.mount() 31 32 if (splideWrapper.getAttribute('name')) { 33 window[splideWrapper.getAttribute('name')] = splideInstance 34 } 35 36 }) 37 } 38 document.head.appendChild(splideMinCss) 39 document.head.appendChild(splideMinJs) 40 } 41})
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.