PageSourceSearch

https://swedishwealthinstitute.com/wp-content/plugins/diviflash/public/js/contentcarousel.js?ver=1.4.12

js swedishwealthinstitute.com collected 2026-10-04 20:01:33 UTC 7,394 bytes, 210 lines download raw bytes

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') {
149        var settings = {
150            selector: '.df_cci_image_container',
151            subHtmlSelectorRelative: true,
152            addClass: 'df_cc_lightbox',
153            counter: false,
154            download: options.download
155        };
156
157        lightGallery(selector, settings);
158    }
159}
160function df_cc_handle_mouseover_event(ele) {
161    const hover_class = 'df-ele-hover';
162    let class_list = ele.classList;
163
164    ele.addEventListener('mouseleave', function(event) {
165        if(class_list.contains(hover_class)) {
166            setTimeout(function(){
167                ele.classList.remove(hover_class);
168            }, 3000);
169        }
170    })
171
172    ele.addEventListener('mouseenter', function(event) {
173        if( !ele.classList.contains(hover_class) ) {
174            ele.classList.add(hover_class);
175        }
176    })
177}
178
179function inViewport(selector) {
180
181    const offset = 10;
182    const element = selector.getBoundingClientRect();
183    const elementTop = Math.round(element.top) + offset;
184    const elementBottom = Math.round(element.bottom);
185
186    return elementTop <= window.innerHeight && elementBottom >= 0
187}
188
189function handleAutoplay(selector, swiper) {
190    if ( inViewport(selector) ) {
191        swiper.autoplay.start();
192
193        return;
194    }
195
196    swiper.autoplay.stop();
197}
198
199const handleEmptyItem = () => {
200	const container = document.querySelectorAll( '.difl_contentcarouselitem' );
201	if ( ! container ) return;
202	[ ...container ].forEach( element => {
203		if ( ! element.querySelector( '.et_pb_module_inner .df_cci_container' ) ) {
204			element.remove();
205		}
206	} )
207}
208
209
210window.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.