PageSourceSearch

https://www.cattolicaeracleaonline.it/wp-content/themes/fonix/assets/js/main.js?ver=7.1.2

js cattolicaeracleaonline.it collected 2026-10-02 12:56:16 UTC 18,706 bytes, 572 lines download raw bytes

1(function($){
2
3    'use strict';
4
5
6    function isScrolledIntoViewport(elem) {
7        var docViewTop = $(window).scrollTop();
8        var docViewBottom = docViewTop + $(window).height();
9
10        var elemTop = $(elem).offset().top;
11        var elemBottom = elemTop + $(elem).height();
12
13        return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
14    }
15
16    // Site Preload & Fix transitions on load
17    $(window).on('load', function() {
18        $("body").addClass("site-loaded");
19    });
20
21
22    // Smooth Scroll
23    if( typeof SmoothScroll == 'function' && $('body').hasClass('rivax-smooth-scroll') ) {
24        SmoothScroll({ keyboardSupport: false });
25    }
26
27
28    // Post Reading Progress Indicator
29    if($('.post-reading-progress-indicator').length) {
30        $(window).on('scroll', function () {
31            let docHeight = $("body").height();
32            let winHeight = $(window).height();
33            let viewport = docHeight - winHeight;
34            let scrollPos = $(window).scrollTop();
35            let scrollPercent = (scrollPos / viewport) * 100;
36            $(".post-reading-progress-indicator span").css("width", scrollPercent + "%");
37
38        });
39    }
40
41
42    // Offcanvas
43    $('.offcanvas-container').on('click', function (e) {
44        e.stopPropagation();
45    });
46    $('body').on('click', '.offcanvas-opener', function (e) {
47        e.stopPropagation();
48        $(this).closest('.rivax-offcanvas').find('.offcanvas-wrapper').addClass('open');
49    });
50
51    $('body, .offcanvas-closer').on('click', function (e) {
52        $('.offcanvas-wrapper').removeClass('open');
53    });
54
55    // Popup Search
56    $('body').on('click', '.popup-search-opener', function (e) {
57        e.stopPropagation();
58        $(this).closest('.popup-search-wrapper').find('.popup-search').addClass('open');
59    });
60
61    $('.popup-search-container').on('click', function (e) {
62        e.stopPropagation();
63    });
64
65    $('body, .popup-search-closer').on('click', function (e) {
66        $('.popup-search').removeClass('open');
67    });
68
69
70
71    // Sticky Header
72    $(window).on('scroll', function () {
73
74        if ( $('#site-sticky-header').length == 0 ) { // Check sticky header is enabled
75            return;
76        }
77
78        var stickyPos = $('#site-header').outerHeight() + 300;
79        var scroll = $(window).scrollTop();
80
81        if( scroll > stickyPos ) {
82            $('#site-sticky-header').addClass('fixed');
83
84            // Smart Sticky Sidebar & Elementor Column
85            var stickyHeight = $('#site-sticky-header').outerHeight();
86            $('.sidebar-container.sticky .sidebar-container-inner, .elementor-column.rivax-sticky-column > *').css('top', stickyHeight + 10);
87        }
88        else {
89            $('#site-sticky-header').removeClass('fixed');
90            $('#site-sticky-header .popup-search').removeClass('open');
91            $('#site-sticky-header .offcanvas-wrapper').removeClass('open');
92
93            // Smart Sticky Sidebar & Elementor Column
94            $('.sidebar-container.sticky .sidebar-container-inner, .elementor-column.rivax-sticky-column > *').css('top', 10);
95        }
96    });
97
98
99	// Header Nav prevent # jump
100	$('.rivax-header-nav li > a[href="#"]').on('click', function (e) {
101        e.preventDefault();
102    });
103	
104	
105	
106    // Header Vertical Nav
107    $('.rivax-header-v-nav li.menu-item-has-children > a').on('click', function (e) {
108        e.preventDefault();
109        $(this).siblings('.sub-menu').slideToggle();
110    });
111
112
113
114
115    // Header Mega Menu
116	$('.rivax-header-nav .sub-menu.mega-menu-content').css('display', 'block');
117    $('.rivax-header-nav li.rivax-mega-menu-4-col > .sub-menu').css('display', 'flex');
118    $('body').on('mouseenter', '.rivax-header-nav li.rivax-mega-menu-item, .rivax-header-nav li.rivax-mega-menu-4-col', function() {
119        var megaMenuWidth = $(this).closest('.elementor-container').width();
120
121        // No need for default header.
122        if(megaMenuWidth === undefined)
123            return;
124
125        var subMenu = $(this).children('.sub-menu');
126        subMenu.css('width', megaMenuWidth);
127
128        var menuPos = $(this).closest('.rivax-header-nav').offset().left;
129        var elementorContainerPos = $(this).closest('.elementor-container').offset().left;
130
131        if( $('body').hasClass('rtl') ) {
132            var menuRightPos = menuPos + $(this).closest('.rivax-header-nav').width();
133            var elementorContainerRightPos = elementorContainerPos + megaMenuWidth;
134
135            subMenu.css('right', parseInt(menuRightPos - elementorContainerRightPos));
136
137        }
138        else {
139            subMenu.css('left', parseInt(elementorContainerPos - menuPos));
140        }
141
142
143    });
144
145
146
147
148    // Back to Top Button
149    $(window).on('scroll', function (e) {
150
151        var showPos = $('#site-header').outerHeight() + 200;
152        var scroll = $(window).scrollTop();
153
154        if( scroll > showPos ) {
155            $('#back-to-top').addClass('show');
156        }
157        else {
158            $('#back-to-top').removeClass('show');
159        }
160
161    });
162
163    $('#back-to-top').click(function(e) {
164        $('body,html').animate({scrollTop:0},800);
165    });
166
167
168    // Fixed Next And Previous Posts
169    $(window).on('scroll', function (e) {
170
171        var scroll = $(window).scrollTop();
172
173        if( scroll > 900 ) {
174            $('.single-fixed-next-prev-posts').addClass('show');
175        }
176        else {
177            $('.single-fixed-next-prev-posts').removeClass('show');
178        }
179
180    });
181
182
183    // Footer Canvas Menu
184    $('.footer-canvas-menu-btn').click(function(e) {
185        if( $(this).hasClass('active') ) {
186            $(this).removeClass('active');
187            $('html').removeClass('footer-canvas-menu-active');
188        }
189        else {
190            $(this).addClass('active');
191            $('html').addClass('footer-canvas-menu-active');
192        }
193
194    });
195
196
197
198    // Comments Area Collapsable
199    $('.comments-list-collapse-btn').on('click', function (e) {
200        var commentsArea = $('.comments-area');
201        var btn = $(this);
202
203        if( commentsArea.hasClass('collapsed') ) {
204            commentsArea.slideDown();
205            commentsArea.removeClass('collapsed');
206            btn.text( btn.data('hide') );
207        }
208        else {
209            commentsArea.slideUp();
210            commentsArea.addClass('collapsed');
211            btn.text( btn.data('show') );
212        }
213    });
214
215
216    // Single Post Share Link Box
217    $(".single-share-box-link .share-link-btn").on('click', function(){
218        $(".single-share-box-link .share-link-text").select();
219        document.execCommand('copy');
220        $('.single-share-box-link .copied-popup-text').addClass('show');
221        setTimeout(function () {
222            $('.single-share-box-link .copied-popup-text').removeClass('show');
223        }, 2000);
224    });
225
226
227
228    // Infinite Scroll Load More
229    $(window).on('scroll', function () {
230
231        $( ".rivax-post-load-more.infinite-scroll" ).each(function( index ) {
232
233            if( isScrolledIntoViewport($(this)) ) {
234                $(this).trigger("click");
235            }
236
237        });
238
239    });
240
241
242    // Load more posts ajax
243    $('.rivax-post-load-more').on('click', function (e) {
244        e.preventDefault();
245        if($(this).hasClass('hide')) return;
246
247        var loadMoreBtn = $(this);
248        var loadMoreLoader = loadMoreBtn.next('.rivax-post-load-more-loader');
249        var scope = loadMoreBtn.closest('.rivax-posts-container').find('.rivax-posts-wrapper');
250
251        var widgetId = $(this).data('widget-id');
252        var postId = $(this).data('post-id');
253        var pageNumber = $(this).data('current-page') + 1;
254
255
256
257        var data = {
258            action: 'rivax_get_load_more_posts',
259            widgetId: widgetId,
260            postId: postId,
261            pageNumber: pageNumber,
262            qVars: (typeof rivaxLoadMoreQVars !== 'undefined')? rivaxLoadMoreQVars : '',
263        };
264        $.post({
265            url: rivax_ajax_object.AjaxUrl,
266            data: data,
267            dataType: 'json',
268            beforeSend: function() {
269                loadMoreBtn.addClass('hide');
270                loadMoreLoader.addClass('show');
271            },
272            success: function(response) {
273                if(response.data) {
274                    var items = $(response.data);
275
276                    scope.append(items);
277                    if( scope.hasClass('layout-masonry') ) {
278                        scope.masonry( 'appended', items );
279                    }
280                }
281
282
283                if(response.no_more) {
284                    loadMoreLoader.remove();
285                    loadMoreBtn.remove();
286                }
287                else {
288                    loadMoreBtn.data('current-page', pageNumber);
289                }
290            },
291            error: function() {
292
293            },
294            complete: function() {
295                loadMoreBtn.removeClass('hide');
296                loadMoreLoader.removeClass('show');
297            }
298        });
299
300
301    });
302
303
304	// Contact Form
305    $('.rivax-contact-form').on('submit', function (e) {
306        e.preventDefault();
307        var form = $(this);
308        var submitBtn = form.find('.submit-btn');
309        var msgWrapper = form.parent('.rivax-contact-form-wrapper').find('.msg-wrapper');
310
311        if(submitBtn.hasClass('loading')) {
312            return;
313        }
314
315        var data = {
316            action: 'rivax_submit_contact_form',
317            firstName: form.find('#first-name').val(),
318            lastName: form.find('#last-name').val(),
319            email: form.find('#email').val(),
320            subject: form.find('#subject').val(),
321            message: form.find('#message').val(),
322        };
323
324        $.post({
325            url: rivax_ajax_object.AjaxUrl,
326            data: data,
327            dataType: 'json',
328            beforeSend: function() {
329                submitBtn.addClass('loading');
330            },
331            success: function(response) {
332                if(response.msg == 'fill') {
333                    msgWrapper.removeClass('success').addClass('error');
334                    msgWrapper.children('.msg').text( msgWrapper.children('.msg').data('fill') );
335                }
336                else if(response.msg == 'error') {
337                    msgWrapper.removeClass('success').addClass('error');
338                    msgWrapper.children('.msg').text( msgWrapper.children('.msg').data('error') );
339                }
340                else if(response.msg == 'success') {
341                    msgWrapper.removeClass('error').addClass('success');
342                    msgWrapper.children('.msg').text( msgWrapper.children('.msg').data('success') );
343                    form.trigger("reset");
344                }
345
346            },
347            error: function() {
348                msgWrapper.removeClass('success').addClass('error');
349                msgWrapper.children('.msg').text( msgWrapper.children('.msg').data('error') );
350            },
351            complete: function() {
352                submitBtn.removeClass('loading');
353            }
354        });
355
356    });
357	
358	
359	// Social Icon Widget
360	$('.rivax-social-icons a[href=""], .rivax-social-icons a[href="#"]').on('click', function(e) {
361		e.preventDefault();
362	});
363	
364	
365
366    var rivaxWidgetsHandler = function( $scope, $ ) {
367
368        // Post Masonry Layout
369        var masonryPosts = $scope.find('.rivax-posts-wrapper.layout-masonry');
370        if ( masonryPosts.length ){
371            masonryPosts.masonry({
372                itemSelector: '.post-item',
373                percentPosition: true,
374            });
375        }
376
377
378        // Post Carousel Layout
379        var carouselPosts = $scope.find('.rivax-posts-wrapper.layout-carousel .rivax-posts-carousel-wrapper');
380        if ( carouselPosts.length ){
381            var carouselSettings = carouselPosts.data('settings');
382            var carouselContainer = carouselPosts.find('.swiper');
383			var carouselSelector = '#' + carouselPosts.attr('id') + ' .swiper';
384
385
386            if ( 'undefined' === typeof Swiper ) {
387                const asyncSwiper = elementorFrontend.utils.swiper;
388
389                new asyncSwiper( carouselContainer, carouselSettings ).then( ( newSwiperInstance ) => {
390                    var swiper = newSwiperInstance;
391                } );
392            } else {
393                var swiper = new Swiper(carouselSelector, carouselSettings);
394            }
395
396        }
397
398
399
400        // Single Post Gallery Hero
401        if ( $('.single-hero-gallery-container').length ){
402
403            if( $('.single-hero-inside .single-hero-gallery-container').length ) {
404                var gallerySettings = {
405                    slidesPerView: 1,
406                    slidesPerGroup: 1,
407                    centeredSlides: true,
408                    //loop: true,
409                    autoplay: true,
410                    spaceBetween: 30,
411                    a11y: {
412                        enabled: false,
413                    },
414                    navigation: {
415                        nextEl: ".single-hero-gallery-container .swiper-button-next",
416                        prevEl: ".single-hero-gallery-container .swiper-button-prev",
417                    }
418                };
419            }
420            else {
421                var gallerySettings = {
422                    slidesPerView: 1,
423                    slidesPerGroup: 1,
424                    centeredSlides: true,
425                    //loop: true,
426                    autoplay: true,
427                    spaceBetween: 30,
428                    a11y: {
429                        enabled: false,
430                    },
431                    navigation: {
432                        nextEl: ".single-hero-gallery-container .swiper-button-next",
433                        prevEl: ".single-hero-gallery-container .swiper-button-prev",
434                    },
435                    breakpoints: {
436                        576: {
437                            slidesPerView: 2,
438                        },
439                        992: {
440                            slidesPerView: 2,
441                        }
442                    }
443                };
444            }
445
446            var carouselContainer = $('.single-hero-gallery-container .swiper');
447			var carouselSelector = '.single-hero-gallery-container .swiper';
448
449            if ( 'undefined' === typeof Swiper ) {
450                const asyncSwiper = elementorFrontend.utils.swiper;
451
452                new asyncSwiper( carouselContainer, gallerySettings ).then( ( newSwiperInstance ) => {
453                    var swiper = newSwiperInstance;
454                } );
455            } else {
456                var swiper = new Swiper(carouselSelector, gallerySettings);
457            }
458
459        }
460
461
462        // News Ticker
463        if( $scope.find('.rivax-news-ticker-content-wrapper').length ) {
464
465            var contentWrapper = $scope.find('.rivax-news-ticker-content-wrapper');
466            var tickerSettings = contentWrapper.data('settings');
467
468            if( contentWrapper.hasClass('animation-marquee') ) {
469
470                contentWrapper.find('.rivax-news-ticker-items').marquee(tickerSettings);
471
472            }
473            else {
474
475                var carouselContainer = contentWrapper.find('.swiper');
476				var carouselSelector = '#' + contentWrapper.attr('id') + ' .swiper';
477
478                if ( 'undefined' === typeof Swiper ) {
479                    const asyncSwiper = elementorFrontend.utils.swiper;
480
481                    new asyncSwiper( carouselContainer, tickerSettings ).then( ( newSwiperInstance ) => {
482                        var swiper = newSwiperInstance;
483                    } );
484                } else {
485                    var swiper = new Swiper(carouselSelector, tickerSettings);
486                }
487
488            }
489        }
490
491
492
493        // Mailchimp
494        if( $scope.find('.rivax-mailchimp-wrapper').length ) {
495
496            var elForm = $scope.find('.rivax-mailchimp-form'),
497                elMessage = $scope.find('.rivax-mailchimp-response-message');
498
499            elForm.on('submit', function (e) {
500                e.preventDefault();
501                var data = {
502                    action: 'rivax_mailchimp_subscribe',
503                    subscriber_info: elForm.serialize(),
504                    list_id: elForm.data('list-id'),
505                };
506                $.ajax({
507                    type: 'post',
508                    url: rivax_ajax_object.AjaxUrl,
509                    data: data,
510                    success: function success(response) {
511                        elForm.trigger('reset');
512
513                        if (response.status) {
514                            elMessage.removeClass('error');
515                            elMessage.addClass('success');
516                            elMessage.text(response.msg);
517                        } else {
518                            elMessage.addClass('error');
519                            elMessage.removeClass('success');
520                            elMessage.text(response.msg);
521                        }
522
523                        var hideMsg = setTimeout(function () {
524                            elMessage.removeClass('error');
525                            elMessage.removeClass('success');
526                            clearTimeout(hideMsg);
527                        }, 5000);
528                    },
529                    error: function error() {
530
531                    }
532                });
533            });
534
535        }
536
537
538
539
540        // Post Stellar
541        if( $scope.find('.rivax-stellar-wrapper').length ) {
542
543            var wrapper = $scope.find('.rivax-stellar-wrapper');
544
545            wrapper.find('.post-item').on('mouseenter click', function() {
546                if( $(this).hasClass('active') )
547                    return;
548
549                var id = $(this).data('id');
550                wrapper.find('.post-item').removeClass('active');
551                $(this).addClass('active');
552
553                wrapper.find('.image-item').removeClass('active');
554                wrapper.find('.image-item[data-id="' + id + '"]').addClass('active');
555
556            });
557        }
558
559
560    }
561
562
563
564    // Elementor Widgets
565    $( window ).on( 'elementor/frontend/init', function () {
566
567        elementorFrontend.hooks.addAction( 'frontend/element_ready/widget', rivaxWidgetsHandler );
568
569    });
570
571
572})( jQuery );

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.