1window.IntecKosmosBannersAdditional ??= class { 2 constructor(root, sliderParams) { 3 if (root instanceof HTMLElement) 4 this.root = root; 5 this.container = { 6 wrapper: this.root.querySelector('[data-role="items.wrapper"]'), 7 items: this.root.querySelector('[data-role="items"]'), 8 item: this.root.querySelectorAll('[data-role="item"]'), 9 } 10 this.active = true; 11 this.slider = {} 12 13 if (sliderParams instanceof Object) 14 this.sliderParams = sliderParams; 15 } 16 17 init() { 18 if (this.active && this.sliderParams.use) { 19 const Swiper = application.libraries.load('swiper'); 20 21 if (this.root.parentNode.id.indexOf('bx_incl_area') > -1) 22 this.root.parentNode.style.height = '100%'; 23 24 this.slider.settings = { 25 spaceBetween: 10, 26 speed: 400, 27 slidesPerView: 1, 28 loop: this.sliderParams.loop, 29 pagination: { 30 el: this.root.querySelector('.swiper-pagination'), 31 clickable: true, 32 type: 'bullets', 33 enabled: true, 34 } 35 }; 36 37 if (this.sliderParams.auto.use) 38 this.sliderParams.settings.autoplay = { 39 delay: this.sliderParams.auto.time, 40 pauseOnMouseEnter: this.sliderParams.auto.hover 41 } 42 43 this.slider.initialize = () => { 44 if (this.slider.initialized) 45 return; 46 47 this.slider.initialized = true; 48 49 this.container.wrapper.classList.add('swiper'); 50 51 this.container.items.setAttribute('data-class', this.container.items.getAttribute('class')); 52 this.container.items.setAttribute('class', 'swiper-wrapper'); 53 54 this.container.item.forEach((item) => { 55 item.setAttribute('data-class', item.getAttribute('class')); 56 item.setAttribute('class', 'swiper-slide'); 57 }); 58 59 this.slider.instance = new Swiper(this.container.wrapper, this.slider.settings); 60 } 61 62 this.slider.destroy = () => { 63 if (!this.slider.initialized) 64 return; 65 66 this.slider.instance.destroy(true, true); 67 this.slider.instance = null; 68 this.slider.initialized = false; 69 70 //this.container.wrapper.removeAttribute('class'); 71 this.container.items.setAttribute('class', this.container.items.getAttribute('data-class')); 72 this.container.items.removeAttribute('data-class'); 73 74 this.container.item.forEach((item) => { 75 item.setAttribute('class', item.getAttribute('data-class')); 76 item.removeAttribute('data-class'); 77 }); 78 79 this.root.querySelector('.swiper-pagination').innerHTML = '' 80 }; 81 82 this.slider.resizeHandler = () => { 83 if (window.innerWidth > 500) { 84 this.slider.destroy(); 85 } else { 86 this.slider.initialize(); 87 } 88 }; 89 90 this.slider.resizeHandler(); 91 92 window.addEventListener('resize', this.slider.resizeHandler); 93 } 94 } 95}
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.