PageSourceSearch

https://fondazionecrimola.it/wp-content/plugins/divigrid/public/lib/digr_advancedImageCarousel.js?ver=2.0.20

js fondazionecrimola.it collected 2026-09-25 20:38:49 UTC 11,594 bytes, 300 lines download raw bytes

1(function () {
2
3    var digraic_image_carousels = document.querySelectorAll('.digr_advanced_image_carousel');
4
5    [].forEach.call(digraic_image_carousels, function (ele, index) {
6        const container = ele.querySelector('.digraic_container');
7        const data = JSON.parse(container.dataset.settings);
8        const selector = ele.querySelector('.swiper-container');
9
10        const spacebetween = '' !== data.spacebetween ? data.spacebetween : '';
11        const spacebetween_tablet = '' !== data.spacebetween_tablet ? data.spacebetween_tablet : data.spacebetween;
12        const spacebetween_phone = '' !== data.spacebetween_phone ? data.spacebetween_phone : spacebetween_tablet;
13
14        var config = {
15            speed: parseInt(data.speed),
16            loop: data.enable_loop === 'on' ? true : false,
17            centeredSlides: data.enable_centered_slide === 'on' ? true : false,
18            direction: data.direction,
19            threshold: 15,
20            slideClass: 'carousel_items',
21            observer: true,
22            observeParents: true,
23            observeSlideChildren: true,
24            watchSlidesVisibility: true,
25            slideToClickedSlide: true,
26            allowTouchMove: true,
27        };
28
29        // autoplay
30        if (data.autoplay === 'on') {
31            config['autoplay'] = {
32                delay: data.autoplay_delay,
33                disableOnInteraction: false,
34            }
35        }
36
37
38        // arrow navigation
39        if (data.arrow === 'on') {
40            // console.log('arrow');
41            config['navigation'] = {
42                nextEl: '.digraic-arrow-next-' + data.module_order_number,
43                prevEl: '.digraic-arrow-prev-' + data.module_order_number
44            }
45        }
46        // dots pagination
47        if (data.show_pagination === 'on') {
48            config['pagination'] = {
49                el: '.digraic_pagination-' + data.module_order_number,
50                type: 'bullets',
51                clickable: true,
52            };
53        }
54        // effects
55        if (data.effects_type === 'cube') {
56            config['effect'] = data.effects_type;
57            config['slidesPerView'] = 1;
58            // cube settings
59            config['cubeEffect'] = {
60                slideShadows: true,
61                shadow: false,
62                shadowOffset: 20,
63                shadowScale: 0.3
64            };
65        } else if (data.effects_type === 'flip') {
66
67            config['effect'] = data.effects_type;
68            config['slidesPerView'] = 1;
69            config['flipEffect'] = {
70                rotate: 30,
71                slideShadows: true,
72            }
73        } else {
74            config['effect'] = data.effects_type;
75            config['slidesPerView'] = parseInt(data.slideperview);
76            config['spaceBetween'] = parseInt(spacebetween);
77            config['centeredSlides'] = 'on' === data.enable_centered_slide ? true : false;
78            config['breakpoints'] = {
79                // desktop
80                1024: {
81                    slidesPerView: parseInt(data.slideperview),
82                    spaceBetween: parseInt(spacebetween),
83                },
84                // tablet
85                768: {
86                    slidesPerView: parseInt(data.slideperview_tablet),
87                    spaceBetween: parseInt(spacebetween_tablet)
88                },
89                // mobile
90                1: {
91                    slidesPerView: parseInt(data.slideperview_phone),
92                    spaceBetween: parseInt(spacebetween_phone),
93                    direction: 'horizontal'
94                },
95            }
96
97            // coverflow settings
98            if (data.effects_type === 'coverflow') {
99                config['coverflowEffect'] = {
100                    slideShadows: data.slider_shadow === 'on' ? true : false,
101                    rotate: parseInt(data.coverflowRotation),
102                    stretch: parseInt(data.coverflowstretch),
103                    depth: parseInt(data.coverflowdepth),
104                    modifier: parseInt(data.coverflowmodifier)
105                };
106            }
107        }
108        // need to add pause on hover
109        if (typeof Swiper === 'function') {
110            var slider = new Swiper(selector, config);
111            setTimeout(function () {
112                slider.update(true);
113            }, 500);
114
115            // pause on hover
116            if (data.autoplay === 'on' && data.pause_on_hover === 'on') {
117                selector.addEventListener("mouseover", function () {
118                    slider.autoplay.stop();
119                })
120                selector.addEventListener("mouseout", function () {
121                    slider.autoplay.start();
122                })
123            }
124        }
125    })
126
127})();
128
129
130//Static Content Panel
131
132(function ($) {
133    $.fn.digraicCarousel = function () {
134        var $this = $(this),
135            currentSlide = 0,
136            previousSlide = 0,
137            slideNumber = $this.find('.digraic_carousel_content .swiper-slide:not(.swiper-slide-duplicate)').length,
138            barHTML = '',
139            forward,
140            textContainer = $this.find('.digraic_changing_content');
141
142        for (var i = 0; i < slideNumber; i++) {
143            barHTML += `<span class="dot"><span class="dot-number">${i + 1}</span></span>`;
144        }
145
146        $this.find('.digraic_pagination .dot').remove();
147        $this.find('.digraic_pagination').append(barHTML);
148        $this.find('.digraic_pagination .dot').eq(0).addClass('active');
149
150        textContainer.each(function () {
151            var texts = $this.find('.static_content_wrapper').eq(0);
152            texts.addClass('currentUp');
153            var height = texts.outerHeight();
154            if (height) {
155                $(this).css('--h', height + 'px');
156            }
157        });
158
159        setTimeout(function () {
160            $this.addClass('loaded');
161            if ($this.find('.digraic_carousel_content .swiper-container-initialized, .digraic_carousel_content .swiper-initialized').length) {
162                $this.find('.digraic_carousel_content').addClass('loaded');
163            }
164            var init = setInterval(function () {
165                if ($this.find('.digraic_carousel_content .swiper-container-initialized, .digraic_carousel_content .swiper-initialized').length) {
166                    $this.find('.digraic_carousel_content').addClass('loaded');
167                    clearInterval(init);
168                }
169            }, 50);
170        }, 500);
171
172        var bgs = JSON.parse($this.attr('data-settings')).background_slideshow_gallery,
173            bgHTML = '<div class="digraic_slider_background">';
174        if (bgs) {
175            bgs.forEach(function (background) {
176                bgHTML += `<img src="${background}"/>`;
177            });
178        }
179        bgHTML += '</div>';
180        $this.find('.digraic_slider_background').remove();
181        $this.prepend(bgHTML);
182        var backgrounds = $this.find('.digraic_slider_background img');
183        backgrounds.eq(0).addClass('currentForward');
184
185        setInterval(function () {
186            currentSlide = $this.find('.digraic_carousel_content .swiper-slide-active').attr('data-slideindex');
187            if (previousSlide !== currentSlide) {
188                if (previousSlide < currentSlide) {
189                    forward = true;
190                }
191                if (previousSlide > currentSlide) {
192                    forward = false;
193                }
194                if (previousSlide == slideNumber - 1 && currentSlide == 0) {
195                    forward = true;
196                }
197                if (previousSlide == 0 && currentSlide == slideNumber - 1) {
198                    forward = false;
199                }
200                textContainer.each(function () {
201                    var texts = $(this).find('.static_content_wrapper');
202                    $(this).css('--h', texts.eq(currentSlide).outerHeight() + 'px');
203                    texts.removeClass('prev next currentUp currentDown');
204                    backgrounds.removeClass('prev currentBackward currentForward');
205                    backgrounds.eq(previousSlide).addClass('prev');
206                    if (forward) {
207                        texts.eq(previousSlide).addClass('prev');
208                        texts.eq(currentSlide).addClass('currentUp');
209                        backgrounds.eq(currentSlide).addClass('currentForward');
210                    } else {
211                        texts.eq(previousSlide).addClass('next');
212                        texts.eq(currentSlide).addClass('currentDown');
213                        backgrounds.eq(currentSlide).addClass('currentBackward');
214                    }
215                });
216
217                $this.find('.digraic_pagination .dot').removeClass('active');
218                $this.find('.digraic_pagination .dot').eq(currentSlide).addClass('active');
219            }
220            previousSlide = currentSlide;
221        }, 500);
222
223        $this.find('.digraic_pagination .dot').on('click', function () {
224            var index = $(this).index();
225            $this.find('.digraic_carousel_content .swiper-pagination-bullet').eq(index).trigger('click');
226            $this.find('.digraic_carousel_content .swiper-container').trigger('mouseleave');
227        });
228
229        $this.find('.as-slider-left').on('click', function () {
230            $this.find('.digraic_carousel_content .elementor-swiper-button-prev').trigger('click');
231            $this.find('.digraic_carousel_content .elementor-swiper').trigger('mouseleave');
232        });
233
234        $this.find('.as-slider-right').on('click', function () {
235            $this.find('.digraic_carousel_content .elementor-swiper-button-next').trigger('click');
236            $this.find('.digraic_carousel_content .elementor-swiper').trigger('mouseleave');
237        });
238
239        $this.find('.as-slider-left a, .as-slider-right a').on('click', function (e) {
240            e.preventDefault();
241        });
242
243    };
244
245    $.fn.destroyDigraicCarousel = function () {
246        var $this = $(this);
247
248        // Unbind events
249        $this.off('.digraicCarousel');
250
251        // Remove added classes and styles
252        $this.removeClass('loaded');
253        $this.find('.digraic_carousel_content').removeClass('loaded');
254        $this.find('.digraic_pagination .dot').removeClass('active');
255        $this.find('.digraic_slider_background').remove();
256
257        // Remove added elements
258        $this.find('.digraic_pagination .dot').remove();
259        $this.find('.static_content_wrapper').removeClass('currentUp');
260
261        // Reset inline styles
262        $this.find('.digraic_changing_content').each(function () {
263            $(this).css('--h', '');
264        });
265
266        $this.removeData('digraicCarousel');
267
268    };
269
270})(jQuery);
271
272
273jQuery('.digraic_container').each(function (index, element) {
274    jQuery(element).digraicCarousel();
275    jQuery(window).on('resize', function () {
276        jQuery(element).each(function () {
277            var textContainer = jQuery(this).find('.digraic_changing_content');
278            textContainer.each(function () {
279                var texts = jQuery(this).find('.static_content_wrapper.currentUp, .static_content_wrapper.currentDown');
280                jQuery(this).css('--h', texts.outerHeight() + 'px');
281            });
282        });
283    });
284});
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300

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.