1(function(){ 2 var difl_testimonialcarousel = document.querySelectorAll('.difl_contentcarousel'); 3 [].forEach.call(difl_testimonialcarousel, function(ele, index) { 4 const container = ele.querySelector('.df_cc_container'); 5 const data = JSON.parse(container.dataset.settings); 6 const selector = ele.querySelector('.swiper-container'); 7 8 const item_spacing_tablet = '' !== data.item_spacing_tablet ? data.item_spacing_tablet : data.item_spacing; 9 const item_spacing_phone = '' !== data.item_spacing_phone ? data.item_spacing_phone : item_spacing_tablet; 10 11 // custom breakpoints 12 const desktopBreakpoint = window.matchMedia('(min-width: 992px)').matches; 13 const tabletBreakpoint = window.matchMedia('screen and (min-width: 401px) and (max-width: 768px)').matches; 14 const mobileBreakpoint = window.matchMedia('screen and (max-width: 400px)').matches; 15 16 var config = { 17 speed: parseInt(data.speed), 18 autoplay: false, 19 loop: data.loop, 20 effect: data.effect, 21 centeredSlides: data.centeredSlides === 'on' ? true : false, 22 threshold: 15, 23 slideClass: 'difl_contentcarouselitem', 24 observer: true, 25 observeParents: true, 26 observeSlideChildren: true, 27 watchSlidesVisibility: true, 28 preventClicks : true, 29 preventClicksPropagation: true, 30 slideToClickedSlide: false, 31 32 breakpoints: { 33 // desktop 34 981: { 35 slidesPerView: data.desktop, 36 spaceBetween : parseInt(data.item_spacing) 37 }, 38 // tablet 39 768: { 40 slidesPerView: data.tablet, 41 spaceBetween : parseInt(item_spacing_tablet) 42 }, 43 // mobile 44 1: { 45 slidesPerView: data.mobile, 46 spaceBetween : parseInt(item_spacing_phone) 47 }, 48 } 49 }; 50 51 if (data.effect === 'coverflow') { 52 config['coverflowEffect'] = { 53 slideShadows: data.slideShadows === 'on' ? true : false, 54 rotate: parseInt(data.rotate), 55 stretch: parseInt(data.stretch), 56 depth: parseInt(data.depth), 57 modifier: parseInt(data.modifier) 58 }; 59 } 60 61 if (('off' === data.autoplay && desktopBreakpoint) 62 || ('off' === data.autoplay_tablet && tabletBreakpoint) 63 || ('off' === data.autoplay_phone && mobileBreakpoint)) { 64 config['autoplay'] = false 65 } 66 67 if ('on' === data.autoplay && desktopBreakpoint) { 68 config['autoplay'] = { 69 delay : data.auto_delay, 70 disableOnInteraction: false 71 } 72 } 73 74 if ('on' === data.autoplay_tablet && tabletBreakpoint) { 75 config['autoplay'] = { 76 delay: parseInt(data.auto_delay_tablet), 77 disableOnInteraction: false 78 } 79 } 80 81 if ('on' === data.autoplay_phone && mobileBreakpoint) { 82 config['autoplay'] = { 83 delay: parseInt(data.auto_delay_phone), 84 disableOnInteraction: false 85 } 86 } 87 88 // arrow navigation 89 if (data.arrow === 'on') { 90 config['navigation'] = { 91 nextEl: '.cc-next-'+data.order, 92 prevEl: '.cc-prev-'+data.order 93 } 94 } 95 // dots pagination 96 if (data.dots === 'on') { 97 config['pagination'] = { 98 el: '.cc-dots-'+data.order, 99 type: 'bullets', 100 clickable: true 101 } 102 } 103 104 105 if (typeof Swiper === 'function') { 106 var slider = new Swiper (selector, config); 107 108 setTimeout(function () { 109 slider.update(true); 110 }, 500); 111 112 // pause on hover 113 const pauseOnHoverDesktop = 'on' === data.autoplay && 'on' === data.pause_hover && desktopBreakpoint; 114 const pauseOnHoverTablet = 'on' === data.autoplay_tablet && 'on' === data.pause_hover_tablet && tabletBreakp
114oint; 115 const pauseOnHoverphone = 'on' === data.autoplay_phone && 'on' === data.pause_hover_phone && mobileBreakpoint; 116 117 if (pauseOnHoverDesktop || pauseOnHoverTablet || pauseOnHoverphone) { 118 selector.addEventListener("mouseover", function(){ 119 slider.autoplay.stop(); 120 }) 121 selector.addEventListener("mouseout", function(){ 122 slider.autoplay.start(); 123 }) 124 } 125 126 if (('on' === data.autoplay && desktopBreakpoint && slider) 127 || ('on' === data.autoplay_tablet && tabletBreakpoint && slider) 128 || ('on' === data.autoplay_phone && mobileBreakpoint && slider)) { 129 document.addEventListener('scroll', () => { 130 handleAutoplay(selector, slider); 131 }); 132 133 handleAutoplay(selector, slider); 134 } 135 } 136 // pointer event 137 df_cc_handle_mouseover_event(ele); 138 // use lightbox 139 df_cc_use_lightbox( 140 container.querySelector('.swiper-wrapper'), 141 { 142 cc_lightbox : data.use_lightbox 143 } 144 ); 145 }) 146})() 147function df_cc_use_lightbox(selector, options) { 148 if (options.cc_lightbox !== 'on' || !selector) return; 149 // Only image slides have data-src; icon-only slides have .df_cci_icon_only and no data-src (would pass null to lightgallery) 150 var galleryItems = selector.querySelectorAll('.df_cci_image_container'); 151 if (!galleryItems.length) return; 152 153 var settings = { 154 selector: '.df_cci_image_container', 155 subHtmlSelectorRelative: true, 156 addClass: 'df_cc_lightbox', 157 counter: false, 158 download: options.download 159 }; 160 161 lightGallery(selector, settings); 162} 163function df_cc_handle_mouseover_event(ele) { 164 const hover_class = 'df-ele-hover'; 165 let class_list = ele.classList; 166 167 ele.addEventListener('mouseleave', function(event) { 168 if(class_list.contains(hover_class)) { 169 setTimeout(function(){ 170 ele.classList.remove(hover_class); 171 }, 3000); 172 } 173 }) 174 175 ele.addEventListener('mouseenter', function(event) { 176 if( !ele.classList.contains(hover_class) ) { 177 ele.classList.add(hover_class); 178 } 179 }) 180} 181 182function inViewport(selector) { 183 184 const offset = 10; 185 const element = selector.getBoundingClientRect(); 186 const elementTop = Math.round(element.top) + offset; 187 const elementBottom = Math.round(element.bottom); 188 189 return elementTop <= window.innerHeight && elementBottom >= 0 190} 191 192function handleAutoplay(selector, swiper) { 193 if ( inViewport(selector) ) { 194 swiper.autoplay.start(); 195 196 return; 197 } 198 199 swiper.autoplay.stop(); 200} 201 202const handleEmptyItem = () => { 203 const container = document.querySelectorAll( '.difl_contentcarouselitem' ); 204 if ( ! container ) return; 205 [ ...container ].forEach( element => { 206 if ( ! element.querySelector( '.df_cci_container' ) ) { 207 element.remove(); 208 } 209 } ) 210} 211 212 213window.addEventListener( 'DOMContentLoaded', handleEmptyItem )
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.