PageSourceSearch

https://festivalliterariosc.com.br/wp-content/themes/feiradolivrojlle/assets/js/main.js?ver=1791228549.8485

js festivalliterariosc.com.br collected 2026-10-10 01:17:24 UTC 14,051 bytes, 401 lines download raw bytes

1( function( $ ) {
2
3    var isMobile = {
4        Android: function() {
5            return navigator.userAgent.match(/Android/i);
6        },
7        BlackBerry: function() {
8            return navigator.userAgent.match(/BlackBerry/i);
9        },
10        iOS: function() {
11            return navigator.userAgent.match(/iPhone|iPad|iPod/i);
12        },
13        Opera: function() {
14            return navigator.userAgent.match(/Opera Mini/i);
15        },
16        Windows: function() {
17            return navigator.userAgent.match(/IEMobile/i) || navigator.userAgent.match(/WPDesktop/i);
18        },
19        any: function() {
20            return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
21        }
22    };
23
24    window.onload = function(){
25        new WOW().init();
26        // $('#preloader').fadeOut();
27
28
29        $('.slideVideos .swiper-slide').each(function() {
30            $(this).find('iframe').attr('src', $(this).find('iframe').attr('data-src'));
31        })
32
33        const slideVideos = new Swiper('.slideVideos', {
34            slidesPerView: 1,
35            spaceBetween: 30,
36            disableOnInteraction: true,
37            pagination: {
38                el: '#videos .swiper-pagination',
39                clickable: true,
40            },
41            // navigation: {
42            //     nextEl: '.swiper-button-next',
43            //     prevEl: '.swiper-button-prev',
44            // },
45        });
46
47        // Inicializar Swiper da imagem principal (sem navegação própria)
48        const galleryMain = new Swiper('.gallery-main', {
49            spaceBetween: 10,
50            allowTouchMove: false, // Desabilita navegação por toque na imagem principal
51            effect: 'fade',
52            fadeEffect: {
53                crossFade: true
54            }
55        });
56
57        // Inicializar Swiper das thumbnails (controla toda a navegação)
58        const galleryThumbs = new Swiper('.gallery-thumbs', {
59            slidesPerView: 'auto',
60            spaceBetween: 10,
61            freeMode: false,
62            watchSlidesProgress: true,
63            navigation: {
64                nextEl: '.gallery-next',
65                prevEl: '.gallery-prev',
66            },
67            autoplay: {
68                delay: 2500,
69                disableOnInteraction: false,
70            },
71            // breakpoints: {
72            //     320: {
73            //         slidesPerView: 2,
74            //         spaceBetween: 8
75            //     },
76            //     768: {
77            //         slidesPerView: 3,
78            //         spaceBetween: 10
79            //     },
80            //     1024: {
81            //         slidesPerView: 4,
82            //         spaceBetween: 10
83            //     }
84            // }
85        });
86
87        // Inicializar Swiper do depoimentos
88        const depoimentosSlider = new Swiper('.slideDepoimentos', {
89            slidesPerView: 1,
90            spaceBetween: 20,
91            disableOnInteraction: true,
92            pagination: {
93                el: '#depoimentos .swiper-pagination',
94                clickable: true,
95            },
96        });
97
98        // Inicializar Swiper curadores
99        const swiperCuradores = new Swiper('.swiper-curadores', {
100            slidesPerView: 1,
101            spaceBetween: 10,
102            freeMode: false,
103            navigation: {
104                nextEl: '#curadores .swiper-next',
105                prevEl: '#curadores .swiper-prev',
106            },
107            autoplay: {
108                delay: 2500,
109                disableOnInteraction: true,
110            },
111            breakpoints: {
112                320: {
113                    slidesPerView: 1,
114                    spaceBetween: 8
115                },
116                768: {
117                    slidesPerView: 2,
118                    spaceBetween: 10
119                },
120                1024: {
121                    slidesPerView: 3,
122                    spaceBetween: 10
123                }
124            }
125        });
126        
127        // Inicializar Swiper homenagem
128        const swiperHomenagem = new Swiper('.swiper-homenagem', {
129            slidesPerView: 1,
130            spaceBetween: 10,
131            freeMode: false,
132            navigation: {
133                nextEl: '#homenagem .swiper-next',
134                prevEl: '#homenagem .swiper-prev',
135            },
136            autoplay: {
137                delay: 2500,
138                disableOnInteraction: true,
139            },
140            breakpoints: {
141                320: {
142                    slidesPerView: 1,
143                    spaceBetween: 8
144                },
145                768: {
146                    slidesPerView: 2,
147                    spaceBetween: 10
148                },
149                1024: {
150                    slidesPerView: 3,
151                    spaceBetween: 10
152                }
153            }
154        });
155
156    };
157
158    $(document).ready(function() {
159        if (!Cookies.get('cookies_policy')) {
160            $('#cookies').toggleClass('active');
161        }
162
163        if (window.location.href.indexOf("/page/") > -1) {
164            // alert("paginação");
165            $('html,body').animate({
166                scrollTop: $("#grid").offset().top -100
167            }, 'slow');
168        }
169    });
170
171    $(document).keyup(function(e) {
172        if (e.key === "Escape") {
173           $('#popup.product').removeClass('visible');
174            $('body').removeClass('popup_open');
175       }
176   });
177
178   /* Open - Popup */
179   $('.open_modal').on('click', function (e) {
180        e.preventDefault();
181        const id = $(this).data('target');
182        $(id).modal('show');
183        console.log('Abrir autor');
184        return;
185    });
186    $('.close_popup').on('click', function (e) {
187        e.preventDefault();
188        $(this).closest('.modal').modal('hide');
189        return;
190    });
191    /* END - Popup */
192
193    /* Open - Menu mobile */
194    $('.main-menu-toggle').on('click', function () {
195        $('#menu-mobile').toggleClass('active');
196        $('body').toggleClass('menu_open');
197    });
198    $(".menu-box a[href^='#']").on("click", function(e) {
199        $('#menu-mobile').toggleClass('active');
200        $('body').toggleClass('menu_open');
201    });
202    /* END - Menu mobile */
203
204    /* Accept Cookies Policy */
205    $('#cookies').on('click', '.accept', function (e) {
206        e.preventDefault();
207
208        Cookies.set('cookies_policy', true, { expires: 30 })
209        $(this).closest('#cookies').toggleClass('active');
210    });
211    /* END - Accept Cookies Policy */
212
213
214    // FOMRULARIOS ENVIO ALERT
215    document.addEventListener( 'wpcf7mailsent', function( event ) {
216        Swal.fire({
217            position: 'center',
218            icon: 'success',
219            title: 'Recebemos seu contato!',
220            showConfirmButton: false,
221            timer: 3000
222        });
223        $('input.wpcf7-validates-as-required').css('border-bottom-color', '#d1d1d1');
224        // location = 'https://t.me/+g7EZeuYE5T04ZDcx';
225    }, false );
226    document.addEventListener( 'wpcf7invalid', function( event ) {
227        // console.log(event);
228        // console.log(event.detail.apiResponse.invalid_fields);
229        var formValid = true;
230        var $vazios = $('form input.wpcf7-validates-as-required');
231        // console.log($vazios);
232        // if ($vazios.val() == '') {
233        $vazios.each(function() {
234            // console.log($(this));
235            if ($(this).val() == '') {
236                formValid = false;
237                $('input.wpcf7-validates-as-required:placeholder-shown').css('border-bottom-color', '#e42622');
238            } else {
239                $('input.wpcf7-validates-as-required:not(:placeholder-shown)').css('border-bottom-color', '#d1d1d1');
240            }
241        });
242
243        if (!formValid) {
244            Swal.fire({
245                position: 'center',
246                icon: 'error',
247                title: 'Preencha os campos obrigatórios!',
248                showConfirmButton: false,
249                timer: 2000
250              });
251        } else {
252            event.detail.apiResponse.invalid_fields.forEach((e, i) => {
253                if(e.field == 'email'){
254                    $('input[name="email"]').css('border-bottom-color', '#e42622');
255                    Swal.fire({
256                        position: 'center',
257                        icon: 'error',
258                        title: 'Formato de e-mail inválido',
259                        showConfirmButton: false,
260                        timer: 2000
261                    });
262                } else if(e.field == 'telefone'){
263                    $('input[name="telefone"]').css('border-bottom-color', '#e42622');
264                    Swal.fire({
265                        position: 'center',
266                        icon: 'error',
267                        title: 'Formato de telefone inválido',
268                        showConfirmButton: false,
269                        timer: 2000
270                    });
271                }
272            });
273        }        
274          
275    }, false );
276
277    // Functions scroll
278    var didScroll;
279    var lastScrollTop = 0;
280    var delta = 5;
281    var navbarHeight = $('#masthead').outerHeight();
282    $(window).scroll(function(event){
283        didScroll = true;
284    });
285
286    setInterval(function() {
287        if (didScroll) {
288            hasScrolled();
289            didScroll = false;
290        }
291    }, 250);
292
293    function hasScrolled() {
294        var st = $(this).scrollTop();
295
296        // Make sure they scroll more than delta
297        if(Math.abs(lastScrollTop - st) <= delta)
298            return;
299
300        // If they scrolled down and are past the navbar, add class .nav-up.
301        // This is necessary so you never see what is "behind" the navbar.
302        if (st > navbarHeight){
303            // Scroll Down
304            $('header').addClass('sticky');
305            // $('.gotop').addClass('visible');
306        } else {
307            // Scroll Up
308            if(st + $(window).height() < $(document).height()) {
309                $('header').removeClass('sticky');
310                // $('.gotop').removeClass('visible');
311            }
312        }
313
314        lastScrollTop = st;
315    }
316
317    // Animação de números
318    function animateCounter(element) {
319        const targetNumber = parseFloat(element.getAttribute('data-number'));
320        const prefix = element.getAttribute('data-prefix') || '';
321        const duration = 2000; // Duração da animação em ms
322        const hasDecimal = targetNumber % 1 !== 0; // Verifica se tem decimal
323        
324        const valueSpan = element.querySelector('.stat-value');
325        if (!valueSpan) return;
326        
327        const startTime = performance.now();
328        
329        function updateCounter(currentTime) {
330            const elapsed = currentTime - startTime;
331            const progress = Math.min(elapsed / duration, 1);
332            
333            // Easing function (easeOutExpo) para uma animação mais suave
334            const easeProgress = progress === 1 ? 1 : 1 - Math.pow(2, -10 * progress);
335            
336            const currentNumber = targetNumber * easeProgress;
337            
338            // Formatar o número
339            let displayNumber;
340            if (hasDecimal) {
341                displayNumber = currentNumber.toFixed(1);
342            } else {
343                displayNumber = Math.floor(currentNumber).toString();
344                // Adicionar separador de milhares se necessário
345                if (currentNumber >= 1000) {
346                    displayNumber = displayNumber.replace(/\B(?=(\d{3})+(?!\d))/g, '.');
347                }
348            }
349            
350            // Atualizar apenas o span do valor
351            valueSpan.textContent = prefix + displayNumber;
352            
353            if (progress < 1) {
354                requestAnimationFrame(updateCounter);
355            }
356        }
357        
358        requestAnimationFrame(updateCounter);
359    }
360    
361        // Intersection Observer para detectar quando os números entram na viewport
362    const observerOptions = {
363        threshold: 0.3,
364        rootMargin: '0px'
365    };
366    
367    const counterObserver = new IntersectionObserver(function(entries) {
368        entries.forEach(function(entry) {
369            if (entry.isIntersecting && !entry.target.classList.contains('counted')) {
370                // Verificar se o elemento pai (stat-item) está visível (animação WOW concluída)
371                const statItem = entry.target.closest('.stat-item');
372                
373                // Função para verificar e iniciar animação
374                function checkAndAnimate() {
375                    // Verifica se o WOW já aplicou a animação (elemento está visível)
376                    const isVisible = statItem && window.getComputedStyle(statItem).visibility === 'visible';
377                    const hasWowAnimated = statItem && statItem.classList.contains('animated');
378                    
379                    if (isVisible || hasWowAnimated) {
380                        entry.target.classList.add('counted');
381                        animateCounter(entry.target);
382                    } else {
383                        // Se ainda não está visível, aguardar um pouco e verificar novamente
384                        setTimeout(checkAndAnimate, 100);
385                    }
386                }
387                
388                checkAndAnimate();
389            }
390        });
391    }, observerOptions);
392    
393    // Observar todos os elementos .stat-number
394    document.addEventListener('DOMContentLoaded', function() {
395        const statNumbers = document.querySelectorAll('.stat-number');
396        statNumbers.forEach(function(stat) {
397            // Observar o elemento
398            counterObserver.observe(stat);
399        });
400    });
401}( 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.