PageSourceSearch

https://www.abre.org.br/wp-content/themes/abre/assets/js/script.js?1774357593

js abre.org.br collected 2026-10-02 04:03:44 UTC 11,978 bytes, 361 lines download raw bytes

1if ( typeof _arr === 'undefined' ) {
2    // Transforma objetos HTMLCollection em arrays mais fáceis de lidar
3    function _arr( _o ) {
4        return Array.prototype.slice.call( _o );
5    }
6}
7
8// Ao carregar a janela
9window.addEventListener( 'load', function () {
10
11    // Esconde botões de submit e envia formulários ao mexer no select
12    _arr( document.getElementsByClassName( '--send-on-change' ) ).forEach( function ( _f ) {
13        _arr( _f.querySelectorAll( 'select' ) ).forEach( function ( _s ) {
14            _s.addEventListener( 'change', function ( _os ) {
15                document.querySelector( 'body' ).classList.add( '--loading' );
16                _os.currentTarget.closest( 'form' ).submit();
17            } );
18        } );
19        _arr( _f.querySelectorAll( 'input[type="submit"]' ) ).forEach( function ( _b ) {
20            _b.setAttribute( 'hidden', 'hidden' );
21        } );
22	});
23
24	_arr( document.getElementsByClassName( '--send-on-change-associados' ) ).forEach( function ( _f ) {
25        _arr( _f.querySelectorAll( 'select' ) ).forEach( function ( _s ) {
26            _s.addEventListener( 'change', function ( _os ) {
27                document.querySelector( 'body' ).classList.add( '--loading' );
28				const selectedOption = _os.currentTarget.options[_os.currentTarget.selectedIndex];
29				const dataLink = selectedOption.getAttribute('data-link');
30				if (dataLink) {
31					window.location.href = dataLink;
32				}
33            } );
34        } );
35        _arr( _f.querySelectorAll( 'input[type="submit"]' ) ).forEach( function ( _b ) {
36            _b.setAttribute( 'hidden', 'hidden' );
37        } );
38	});
39
40
41
42    // Javascript do Header
43    jQuery( '.header__toggle' ).on( 'click' , function(e){
44        const body = jQuery( 'body' );
45        body.toggleClass( '-menu-visible' );
46        e.preventDefault();
47    });
48
49    jQuery(document).keyup(function(e) {
50        const body = jQuery( 'body' );
51        if (body.hasClass('-menu-visible')) {
52            if(e.keyCode === 27) {
53                body.removeClass( '-menu-visible' );
54            }
55        }
56    });
57
58    jQuery( '.header__close-menu').on( 'click' , function(e){
59        const body = jQuery( 'body' );
60        body.removeClass( '-menu-visible' );
61        e.preventDefault();
62    });
63
64
65    // Home
66    jQuery( '.cat-desc__action' ).on( 'click' , function(e){
67        const target = jQuery( this ).attr( 'href' );
68        jQuery( this ).addClass( '-is-active' ).siblings( '.-is-active' ).removeClass( '-is-active' );
69        jQuery( this ).parents( '.cat-desc' ).find( target ).addClass( '-is-active' ).siblings( '.-is-active' ).removeClass( '-is-active' );
70        e.preventDefault();
71    });
72
73    // Filter Events
74    jQuery(' .events-list__label' ).on( 'click' , function() {
75        jQuery(  '.events-list__label' ).removeClass( '-is-active' );
76        jQuery( this ).addClass( '-is-active' );
77    });
78
79
80    //  Grade de Aulas ( single curso )
81    jQuery( '.grade-aula' ).each( function(){
82        jQuery( this ).find( '.list-date > li > a' ).click( function(){
83
84            // pega o HREF do botão clicado, que é o ID do conteúdo a ser mostrado
85            var id = jQuery( this ).attr( 'href' );
86
87            // se o botão não tem a classe active
88            if( !jQuery( this ).hasClass('-is-active') ){
89
90                // Remove a classe active de todos os botões, depois adiciona no clicado
91                jQuery( this ).parents('.list-date').find( 'li' ).removeClass('-is-active');
92                jQuery( this ).parents('li').addClass('-is-active');
93
94                // Mostrando conteudo
95                jQuery( this ).parents('.grade-aula').find('.list-content > li').removeClass('-is-active');
96                jQuery( id ).addClass('-is-active');
97            }
98
99            return false;
100        } )
101    } );
102
103    // Carrossel da home
104    jQuery( '.banners' ).each( function(){
105        const slider = jQuery( this ).find( '.banners__slider' ),
106              nav = jQuery( this ).find( '.banners__slider-nav'),
107              prev_arrow = jQuery( this ).find( '.-prev' ),
108              next_arrow = jQuery( this ).find( '.-next' );
109
110        slider.slick({
111            slidesToShow: 1,
112            slidesToScroll: 1,
113            arrows: true,
114            dots: true,
115            appendDots: nav,
116            prevArrow: prev_arrow,
117            nextArrow: next_arrow,
118            dotsClass: 'banner__control',
119            autoplay: true,
120            autoplaySpeed: 5000,
121        });
122    });
123
124    jQuery( '.connection' ).each( function(){
125        const slider = jQuery( this ).find( '.connection__slider' ),
126              nav = jQuery( this ).find( '.connection__nav'),
127              prev_arrow = jQuery( this ).find( '.-prev' ),
128              next_arrow = jQuery( this ).find( '.-next' );
129
130        slider.slick({
131            slidesToShow: 1,
132            slidesToScroll: 1,
133            arrows: true,
134            dots: true,
135            appendDots: nav,
136            prevArrow: prev_arrow,
137            nextArrow: next_arrow,
138            dotsClass: 'connection__control',
139            autoplay: true,
140            fade: true,
141            autoplaySpeed: 6000,
142        });
143    });
144
145    // Carrossel de parceiros, página conexões
146    jQuery( '.our-partners__ul' ).each( function(){
147        const partners_carousel = jQuery('.our-partners__ul'),
148              partners_prev = jQuery( '.our-partners-prev' ),
149              partners_next = jQuery( '.our-partners-next' );
150
151        partners_carousel.slick({
152            infinite: true,
153            slidesToShow: 4,
154            slidesToScroll: 4,
155            prevArrow: partners_prev,
156            nextArrow: partners_next,
157            autoplay: true,
158            responsive: [
159                {
160                    breakpoint: 1140,
161                    settings: {
162                        slidesToShow: 3,
163                        slidesToScroll: 3
164                    }
165                },
166                {
167                    breakpoint: 640,
168                    settings: {
169                        slidesToShow: 2,
170                        slidesToScroll: 2
171                    }
172                },
173                {
174                    breakpoint: 480,
175                    settings: {
176                        slidesToShow: 1,
177                        slidesToScroll: 1
178                    }
179                },
180            ]
181        });
182    });
183
184    // Carrossel de parceiros, página conexões
185    jQuery( '.temas__ul' ).each( function(){
186        const temas_carousel = jQuery('.temas__ul'),
187              temas_prev = jQuery( '.temas__prev' ),
188              temas_next = jQuery( '.temas__next' );
189
190        temas_carousel.slick({
191            infinite: true,
192            slidesToShow: 5,
193            slidesToScroll: 1,
194            prevArrow: temas_prev,
195            nextArrow: temas_next,
196            centerMode: true,
197            responsive: [
198                {
199                    breakpoint: 1140,
200                    settings: {
201                        slidesToShow: 3,
202                        slidesToScroll: 3
203                    }
204                },
205                {
206                    breakpoint: 640,
207                    settings: {
208                        slidesToShow: 2,
209                        slidesToScroll: 2
210                    }
211                },
212                {
213                    breakpoint: 480,
214                    settings: {
215                        slidesToShow: 1,
216                        slidesToScroll: 1
217                    }
218                },
219            ]
220        });
221    });
222
223    if (jQuery('.temas__carousel .temas__ul').length) {
224        var url = window.location.href;
225        var indextema = jQuery('.temas__carousel .temas__ul li[data-tema="'+url+'"]').data('slick-index');
226        jQuery('.temas__carousel .temas__ul li[data-tema="'+url+'"]').addClass('current-tema');
227        jQuery('.temas__carousel .temas__ul').slick('slickGoTo', indextema);
228    }
229
230    //Ancoragem
231    var url = window.location.href;
232    var url = url.split('#')[1];
233    if (url) {
234        var url = jQuery('#' + url).offset().top - 100;
235        jQuery('html, body').animate({
236            scrollTop: url
237        }, 1000);
238    }
239
240    //Scroll Down
241    jQuery('.banners__scroll-down').on('click', function() {
242        var next = jQuery(this).parent().next().offset().top;
243        jQuery('html,body').animate({
244            scrollTop: next
245        }, 'slow');
246        console.log(next);
247    });
248
249    // Membros sobre
250    jQuery('.membro-more').on('click', function() {
251        jQuery('.membro--item').slideDown({
252            start: function () {
253                jQuery(this).css({
254                    display: "flex"
255                })
256            }
257        });
258
259        jQuery(this).slideUp();
260
261        return false;
262    });
263
264    // Galeria de imagens em eventos
265    if(jQuery('.gallery__images').length) {
266        const gallery_prev = jQuery( '.gallery-prev' ),
267              gallery_next = jQuery( '.gallery-next' );
268
269        jQuery('.gallery__images').slick({
270            infinite: true,
271            slidesToShow: 1,
272            slidesToScroll: 1,
273            prevArrow: gallery_prev,
274            nextArrow: gallery_next,
275        });
276    }
277
278    // Ajusta a margem do box de Comitês
279    if (jQuery('.intro-comite__aside').length) {
280        var hbox = jQuery('.intro-comite__aside').innerHeight();
281        var hbox = (hbox / 2) + 50;
282        if (jQuery(window).width() > 768) {
283            jQuery('.intro-comite').css({'margin-bottom': hbox});
284        }
285    }
286
287    // Adiciona target blank nos links do wp
288    if (jQuery('.wp-block-button.blank').length) {
289        jQuery('.wp-block-button.blank .wp-block-button__link').attr('target', '_blank');
290    }
291
292});
293
294jQuery(document).ready(function() {
295
296    // Jquery menu mobile
297    jQuery('.toggle-nav').click(function(e) {
298        jQuery(this).toggleClass("toggler-open");
299        jQuery('#main-nav-mobile').slideToggle(500);
300        jQuery('.menu-item-has-children > a').attr("href", "#0")
301        e.preventDefault();
302    })
303
304    // Submenu addclass
305    jQuery('.menu-item-has-children').click(function(e) {
306        jQuery(this).find('.sub-menu').toggleClass('submenu_show');
307        e.stopPropagation();
308    })
309
310    // Focus search
311    jQuery('#modal-btn').on('click', function() {
312        setTimeout(function(){
313            jQuery('input[name="s"]').trigger('focus');
314        }, 1000);
315    });
316
317    // Open dinamize footer
318    jQuery('form.formIntegration2 .containerMultiple_cmp51 div:nth-child(2)').click(function() {
319        jQuery('form .containerMultiple_cmp51 div').toggleClass('dinamize-select-show');
320    });
321    jQuery("form.formIntegration2").submit(function() {
322        jQuery('form .containerMultiple_cmp51 div').removeClass('dinamize-select-show');
323    });
324});
325
326// Dinamize termos de aceite
327let inputAceite = document.querySelector('.containerMultiple_cmp56 div
327:nth-child(3) label input');
328inputAceite.value = "Li e concordo com os termos"
329let linkAceite = document.querySelector('.containerMultiple_cmp56 div:nth-child(3)');
330let replaceLink = linkAceite.innerHTML.replace('li e concordo com os termos de uso', 'Li e concordo com os <a href="/politica-de-privacidade/" target="_blank">termos de uso</a>');
331linkAceite.innerHTML = replaceLink;
332
333// Modal
334let modalBtn = document.getElementById("modal-btn")
335let modal = document.querySelector(".modal")
336let closeBtn = document.querySelector(".close-btn")
337modalBtn.onclick = function(){
338    modal.style.display = "block"
339}
340closeBtn.onclick = function(){
341    modal.style.display = "none"
342}
343window.onclick = function(e){
344    if(e.target == modal){
345        modal.style.display = "none"
346    }
347}
348
349// Fixed Menu
350window.onscroll = function() {menuFixedFunction()};
351
352let menuFixed = document.querySelector('header.header')
353let sticky = menuFixed.offsetTop;
354
355function menuFixedFunction() {
356    if (window.pageYOffset > sticky) {
357        menuFixed.classList.add("sticky");
358    } else {
359        menuFixed.classList.remove("sticky");
360    }
361}

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.