1const sau = {}; // t4 does not like window 2 3function registerGlobalModule(nameSpace, module) { 4 if (sau[nameSpace] === undefined) { 5 sau[nameSpace] = module; 6 return sau[nameSpace]; 7 } else { 8 throw new Error(`Module already registered: ${ns}`); 9 } 10} 11 12function getGlobalModule(module) { 13 if (sau[module] !== undefined) { 14 return sau[module]; 15 } else { 16 throw new Error(`Module not registered: ${module}`); 17 } 18} 19 20document.addEventListener('DOMContentLoaded', function () { 21 // Events for all synthetic select elements 22 document.querySelectorAll('.select-dropdown').forEach(elem => 23 elem.addEventListener('click', function (e) { 24 e.stopPropagation(); 25 26 const el = e.target; 27 const selectedValue = el.dataset.selectId; 28 29 if (el === this) { 30 this.classList.toggle('select-dropdown--is-active'); 31 } 32 33 if (selectedValue !== undefined) { 34 const hiddenField = this.querySelector('.select-dropdown__value'); 35 // const didValueChange = hiddenField.value !== el.dataset.selectId; 36 37 this.querySelector('.select-dropdown__selected-option').value = el.textContent || 'Select One...'; // label 38 hiddenField.value = el.dataset.selectId; // hidden field value 39 hiddenField.dispatchEvent(new Event('change')); 40 41 this.classList.remove('select-dropdown--is-active'); 42 43 this.querySelectorAll('.select-dropdown__dropdown-item').forEach(item => item.classList.remove('select-dropdown__dropdown-item--is-active')); 44 el.classList.add('select-dropdown__dropdown-item--is-active'); 45 } 46 }) 47 ); 48}); 49 50 51class TestimonialSlider { 52 index = 0; 53 rootEl = null; 54 iid = null; 55 slides = 0; 56 57 constructor(rootEl) { 58 this.rootEl = rootEl; 59 this.init(); 60 } 61 62 slide(step) { 63 const totalItems = this.slides.length; 64 this.index = (this.index + step + totalItems) % totalItems; // Loop around 65 const offset = -this.index * 100; 66 67 for (let item of this.slides) { 68 item.style.transform = `translateX(${offset}%)`; 69 } 70 } 71 72 previous = () => { 73 this.slide(-1); 74 } 75 76 next = () => { 77 this.slide(1); 78 } 79 80 init() { 81 this.slides = [ 82 ...this.rootEl.querySelectorAll('.testimonial-carousel-item'), 83 ]; 84 // this.iid = setInterval(() => this.slide(1), 5000); 85 const buttonPrevious = this.rootEl.querySelectorAll('.previous'); 86 const buttonNext = this.rootEl.querySelectorAll('.next'); 87 [...buttonNext].forEach((btn) => { 88 if (this.slides.length <= 1) { 89 btn.style.display = 'none'; 90 } else { 91 btn.addEventListener('click', this.next); 92 } 93 }); 94 [...buttonPrevious].forEach((btn) => { 95 if (this.slides.length <= 1) { 96 btn.style.display = 'none'; 97 } else { 98 btn.addEventListener('click', this.previous); 99 } 100 }); 101 } 102 103 destroy() { 104 // clearInterval(this.iid); 105 } 106}
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.