PageSourceSearch

https://www.olfar.ind.br/wp-content/themes/alp-cody/main/assets/js/custom-alp.js?v=1790256221&ver=1.0

js olfar.ind.br collected 2026-09-24 13:27:05 UTC 23,763 bytes, 707 lines download raw bytes

1(function ($) {
2  $(document).ready(function () {
3    //Mostrar menu fixo a partir de um valor do scroll
4    $(window).bind('scroll', function () {
5      if ($(window).scrollTop() > 400) {
6        $('.header-top').addClass('shrink');
7        $('.menu-interno').addClass('shrink');
8      } else {
9        $('.header-top').removeClass('shrink');
10        $('.menu-interno').removeClass('shrink');
11      }
12    });
13    // Cria a distnacia de onde começa a linha do menu
14    $('.menu-footer > .menu-item-has-children > a').each(function (index) {
15      $(this).addClass('first-item-sub-menu');
16    });
17    //Nao fazer nada no click quando possuir sub-menu
18    //  $('.first-item-sub-menu').click(function(e){
19    //   e.preventDefault();
20    // });
21    //Adiciona a linha do menu
22    $('.menu-item-has-children').append('<div class="line"><div class="inner"></div></div>');
23    // Cria a distnacia de onde começa a linha do menu
24    $('.menu-interno-front .menu-item-has-children').each(function (index) {
25      var padding = $(this).find('a').width() + 15;
26      $(this).find('.line').css("padding-right", padding);
27    });
28    // Cria a distnacia de onde começa a linha do menu
29    $('.menu-front .menu-item-has-children').each(function (index) {
30      var padding = $(this).find('a').width() + 15;
31      $(this).find('.line').css("padding-left", padding);
32    });
33    // MENU MOBILE
34    // Abrir
35    $('.toggle-open').click(function () {
36      $('.col-menu-mobile').addClass('on');
37    });
38    //Fechar
39    $('.toggle-close').click(function () {
40      $('.col-menu-mobile').removeClass('on');
41    });
42    //Menu mobile principal    
43    //  $('.menu-mobile-principal .menu-item-has-children > a').click(function(e){
44    //   e.preventDefault();
45    // });  
46    $('.menu-mobile-principal .menu-item-has-children').click(function () {
47      $(this).find('.sub-menu').slideToggle();
48    });
49    // Abrir Menu Interna
50    $('.item-menu-interno').click(function () {
51      $('.menu-interno').toggleClass('on');
52    });
53    //Scroll to DIV Dekstop
54    $('.menu-item').find('a').click(function (e) {
55      var section = $(this).attr('href');
56      if (section.indexOf('#') != -1) {
57        var hash = section.substring(section.indexOf('#') + 1);
58      }
59      else {
60        $("html, body").animate({
61          scrollTop: $('#' + hash).offset().top - 80
62        });
63      }
64    });
65    //Scroll do Div Externo
66    $(window).on("load", function () {
67      setTimeout(function () {
68        var url = window.location.href;
69        var hash = url.substring(url.indexOf("#") + 1);
70        var section = hash.split("/")[0];
71        $("html, body").animate({ scrollTop: $("#" + section).offset().top - 100 }, "slow");
72      }, 100);
73    });
74    // Adiciona o atribudo nas imagens que trocam 
75    var i = 1;
76    $('.menu-front > li').each(function (index) {
77      $(this).attr('data-bg', 'bg0' + i);
78      i++;
79    });
80    // Muda a imagem com o mouse
81    $('.menu-front > li').mouseover(function () {
82      var item = $(this).data('bg');
83      $('.bg-image').removeClass('on');
84      $('#' + item).addClass('on');
85    });
86
87    // Adiciona o blur nas imagens
88    $('.menu-front > li > .sub-menu').mouseover(function () {
89      $('.bg-image').addClass('filtro');
90    });
91    $('.menu-front > li > .sub-menu').mouseout(function () {
92      $('.bg-image').removeClass('filtro');
93    });
94    // Accordion Image
95    $('.select-item').click(function () {
96      var itemAcc = $(this).data('itemacc');
97      $('.select-item').removeClass('on');
98      $(this).addClass('on');
99      $('.item-acc').hide();
100      $('div[data-conteudoacc="' + itemAcc + '"]').fadeIn('slow');
101    });
102    // Slide de Noticias
103    var swiperNoticias = new Swiper(".slide-noticias", {
104      slidesPerView: 4,
105      speed: 2000,
106      pagination: {
107        el: ".swiper-pagination",
108        clickable: true,
109      },
110      breakpoints: {
111        280: {
112          slidesPerView: 1,
113          spaceBetween: 15
114        },
115        480: {
116          slidesPerView: 2,
117          spaceBetween: 15
118        },
119        768: {
120          slidesPerView: 3,
121          spaceBetween: 15
122        },
123        1500: {
124          slidesPerView: 4,
125          spaceBetween: 15
126        },
127      }
128    });
129    // Slide de Blog
130    var swiperPosts = new Swiper(".slide-blog", {
131      slidesPerView: 3,
132      speed: 2000,
133      pagination: {
134        el: ".swiper-pagination",
135        clickable: true,
136      },
137      navigation: {
138        nextEl: ".swiper-button-next",
139        prevEl: ".swiper-button-prev",
140      },
141      breakpoints: {
142        280: {
143          slidesPerView: 2,
144          spaceBetween: 15
145        },
146        480: {
147          slidesPerView: 2,
148          spaceBetween: 15
149        },
150        768: {
151          slidesPerView: 3,
152          spaceBetween: 15
153        },
154      }
155    });
156    // Filtro de Posts
157    $('.col-itens-filtro > ul > .itens-filter').click(function () {
158      var filtro = $(this).data('filtro');
159      $('.itens-filter').removeClass('on');
160      $(this).addClass('on');
161      $('.item-filtro-principal').hide();
162      $('div[data-itemfiltroprincipal="' + filtro + '"]').fadeIn();
163      if (filtro == 'todos') {
164        $('.item-filtro-principal').hide();
165        $('div[data-sequencia="1"]').fadeIn();
166      }
167      if (filtro == 'todos') {
168        $('.item-filtro').fadeIn();
169        swiperNoticias.updateSize();
170        swiperNoticias.updateSlides();
171        swiperNoticias.updateProgress();
172        swiperNoticias.updateSlidesClasses();
173        swiperNoticias.slideTo(0);
174        swiperNoticias.scrollbar.updateSize();
175      } else {
176        $('.item-filtro').hide();
177        $('div[data-itemfiltro="' + filtro + '"]').fadeIn();
178        swiperNoticias.updateSize();
179        swiperNoticias.updateSlides();
180        swiperNoticias.updateProgress();
181        swiperNoticias.updateSlidesClasses();
182        swiperNoticias.slideTo(0);
183        swiperNoticias.scrollbar.updateSize();
184      }
185      return false;
186    });
187
188    // Filtro de Posts
189    $('.filtro-blog > ul > .itens-filter').click(function () {
190      var filtro = $(this).data('filtro');
191      $('.itens-filter').removeClass('on');
192      $(this).addClass('on');
193      $('.item-filtro-principal').hide();
194      $('div[data-itemfiltroprincipal="' + filtro + '"]').fadeIn();
195      if (filtro == 'todos') {
196        $('.item-filtro-principal').hide();
197        $('div[data-sequencia="1"]').fadeIn();
198      }
199      if (filtro == 'todos') {
200        $('.item-filtro').fadeIn();
201        swiperPosts.updateSize();
202        swiperPosts.updateSlides();
203        swiperPosts.updateProgress();
204        swiperPosts.updateSlidesClasses();
205        swiperPosts.slideTo(0);
206        swiperPosts.scrollbar.updateSize();
207      } else {
208        $('.item-filtro').hide();
209        $('div[data-itemfiltro="' + filtro + '"]').fadeIn();
210
211        swiperPosts.updateSize();
212        swiperPosts.updateSlides();
213        swiperPosts.updateProgress();
214        swiperPosts.updateSlidesClasses();
215        swiperPosts.slideTo(0);
216        swiperPosts.scrollbar.updateSize();
217      }
218      return false;
219    });
220    // Slide de Produtos
221    var swiperProdutos = new Swiper(".slide-produtos", {
222      slidesPerView: 1,
223      speed: 2000,
224      autoplay: {
225        delay: 4000,
226        disableOnInteraction: false,
227      },
228      pagination: {
229        el: ".swiper-pagination",
230        clickable: true,
231      },
232      navigation: {
233        nextEl: ".swiper-button-next",
234        prevEl: ".swiper-button-prev",
235      },
236    });
237    // Slide de Empresas
238    var swiperEmpresas = new Swiper(".slide-empresas", {
239      slidesPerView: 5,
240      speed: 2000,
241      loop: true,
242      autoplay: {
243        delay: 4000,
244        disableOnInteraction: false,
245      },
246      pagination: {
247        el: ".swiper-pagination",
248        clickable: true,
249      },
250      breakpoints: {
251        280: {
252          slidesPerView: 2,
253          spaceBetween: 15
254        },
255        480: {
256          slidesPerView: 3,
257          spaceBetween: 15
258        },
259        768: {
260          slidesPerView: 4,
261          spaceBetween: 15
262        },
263        991: {
264          slidesPerView: 5,
265          spaceBetween: 15
266        },
267      }
268    });
269    // Slide de Caracteristicas
270    var swiperCaracteristicas = new Swiper(".slide-caracteristicas", {
271      slidesPerView: 1,
272      speed: 2000,
273      loop: true,
274      autoplay: {
275        delay: 4000,
276        disableOnInteraction: false,
277      },
278      navigation: {
279        nextEl: ".swiper-button-next",
280        prevEl: ".swiper-button-prev",
281      },
282    });
283    // // Filtro de Posts
284    // $('.col-itens-filtro > ul > .itens-filter').click(function() {
285    //   $('.itens-filter').removeClass('on');
286    //   $(this).addClass('on');
287    //   var filtro = $(this).data('filtro');
288    //   $('.item-filtro').hide();
289    //   $('div[data-itemfiltro="' + filtro + '"]').fadeIn('slow');
290    //   if(filtro == 'todos'){
291    //     $('.item-filtro').fadeIn();
292    //   }
293    // });
294
295    // Slide de Imagens Timeline
296    var swiperImagensTimeLine = new Swiper(".swiper-imagens-timeline", {
297      slidesPerView: 1,
298      speed: 1000,
299      navigation: {
300        nextEl: ".swiper-button-next",
301        prevEl: ".swiper-button-prev",
302      },
303    });
304    // Slide de Anos
305    var swiperTimeline = new Swiper(".swiper-anos-timeline", {
306      slidesPerView: 4,
307      speed: 1000,
308      pagination: {
309        el: ".swiper-pagination",
310        clickable: true,
311      },
312      navigation: {
313        nextEl: ".swiper-button-next",
314        prevEl: ".swiper-button-prev",
315      },
316      breakpoints: {
317        280: {
318          slidesPerView: 1
319        },
320        480: {
321          slidesPerView: 2
322        },
323        768: {
324          slidesPerView: 3
325        },
326        991: {
327          slidesPerView: 5
328        },
329      }
330    });
331    // Carrousel de Posts
332    var carrouselPosts = new Swiper(".carrousel-posts", {
333      slidesPerView: 5,
334      spaceBetween: 20,
335      speed: 3000,
336      autoplay: {
337        delay: 4000,
338        disableOnInteraction: false,
339      },
340      pagination: {
341        el: ".swiper-pagination",
342        clickable: true,
343      },
344      breakpoints: {
345        280: {
346          slidesPerView: 1,
347          spaceBetween: 20
348        },
349        480: {
350          slidesPerView: 2,
351          spaceBetween: 20
352        },
353        768: {
354          slidesPerView: 3,
355          spaceBetween: 20
356        },
357        991: {
358          slidesPerView: 4,
359          spaceBetween: 20
360        },
361        1200: {
362          slidesPerView: 5,
363          spaceBetween: 20
364        },
365      }
366    });
367    // Slide de Posts
368    var SlidePosts = new Swiper(".slide-posts", {
369      slidesPerView: 1.4,
370      spaceBetween: 20,
371      speed: 3000,
372      pagination: {
373        el: ".swiper-pagination",
374        clickable: true,
375      },
376    });
377    // Carrousel de Marcas
378    var carrouselPosts = new Swiper(".carrousel-marcas", {
379      slidesPerView: 5,
380      spaceBetween: 20,
381      speed: 3000,
382      autoplay: {
383        delay: 4000,
384        disableOnInteraction: false,
385      },
386      pagination: {
387        el: ".swiper-pagination",
388        clickable: true,
389      },
390      breakpoints: {
391        280: {
392          slidesPerView: 1,
393          spaceBetween: 20
394        },
395        480: {
396          slidesPerView: 3,
397          spaceBetween: 20
398        },
399        768: {
400          slidesPerView: 4,
401          spaceBetween: 20
402        },
403        991: {
404          slidesPerView: 5,
405          spaceBetween: 20
406        },
407        1200: {
408          slidesPerView: 6,
409          spaceBetween: 20
410        },
411      }
412    });
413    // Slide de Vídeos
414    var swiperVideos = new Swiper(".swiper-videos", {
415      slidesPerView: 1,
416      speed: 2000,
417      navigation: {
418        nextEl: ".swiper-button-next",
419        prevEl: ".swiper-button-prev",
420      },
421      // pagination: {
422      //   el: ".swiper-pagination",
423      //   clickable: true,
424      // },
425    });
426
427    // Time line
428    $('.bullet').click(function () {
429      var ano = $(this).data('bulletano');
430      $('.bullet').removeClass('on');
431      $(this).addClass('on');
432      $('.col-info-timeline').hide();
433      $('.col-info-timeline').removeClass('on');
434      $('div[data-timeline="' + ano + '"]').fadeIn('fast').addClass('on');
435    });
436    // Cards Trabalhe Conosco
437    $('.col-card').click(function () {
438      $('.col-card').removeClass('on');
439      $('.col-card').find('.imagem').removeClass('on');
440      $('.col-card').find('.info-card .info').removeClass('on');
441      $(this).addClass('on');
442      $(this).find('.imagem').addClass('on');
443      $(this).find('.info-card .info').addClass('on');
444    });
445    // Mapa
446    $('.pointer').click(function () {
447      $('.pointer').removeClass('on');
448      $(this).addClass('on');
449      var filial = $(this).data('pointer');
450      $('.info-filial').hide();
451      $('.info-filial[data-infomapa="' + filial + '"]').fadeIn('fast');
452    });
453    // LIGHTBOX
454    $('.item-video').click(function (e) {
455      e.preventDefault();
456      $('.lightbox').fadeIn();
457      var itemTipo = $(this).data('tipo');
458      var itemArquivo = $(this).data('arquivo');
459      if (itemTipo == 'imagem') {
460        $('#lightbox-container').append('<img src="' + itemArquivo + '"  id="imagem-lightbox">');
461      }
462      if (itemTipo == 'video') {
463        $('#lightbox-container').append('<video controls src="' + itemArquivo + '"  id="video-lightbox">');
464        var video = $('#video-lightbox')[0];
465        video.play();
466      }
467    });
468    // Modal formulario Trabalhe Conosco
469    $('#lgpdcheck').change(function () {
470      if ($(this).prop('checked')) {
471        $('.btn-avancar').prop("disabled", false);
472      } else {
473        $('.btn-avancar').prop("disabled", true);
474      }
475    });
476    $('.btn-avancar').click(function () {
477      $('#modal-aceite').hide();
478      $('#modal-form').show();
479    });
480    $('.btn-voltar').click(function () {
481      $('#modal-form').hide();
482      $('#modal-aceite').show();
483    });
484    // Fechar as outras abas do accordion ao clicar
485    $('.js-accordion__trigger').click(function () {
486      if ($(this).hasClass('accordion__item--is-open')) {
487        $(this).removeClass('accordion__item--is-open');
488        $(this).find('button').attr('aria-expanded', 'false');
489      }
490      if ($('.accordion__item').hasClass('accordion__item--is-open')) {
491        $('.accordion__item').removeClass('accordion__item--is-open');
492        $('.accordion__item').find('button').attr('aria-expanded', 'false');
493      }
494    });
495    // dolar
496    const Dolar = {
497      dolarValue: document.querySelector('#dolar-cot'),
498      dolarTime: document.querySelector('#dolar-time'),
499      getCotacao() {
500        fetch('https://economia.awesomeapi.com.br/last/USD-BRL')
501          .then(response => response.json())
502          .then(response => {
503            let dolar = response.USDBRL;
504            Dolar.dolarValue.textContent = `R$${dolar.bid}`;
505            let time = dolar.create_date.split(' ');
506            let hour = time[1];
507            let date = time[0].split('-');
508            console.log('hey')
509            Dolar.dolarTime.innerHTML = `${date[2]}/${date[1]}/${date[0]} -  ${hour}`;
510          });
511      },
512      constructor() {
513        this.getCotacao();
514        setInterval(this.getCotacao, 1000000);
515      }
516    }
517    if (Dolar.dolarValue) Dolar.constructor();
518    // API PREVISÃO DO TEMPO
519    // Cria a primeira requisião dos valores
520    var cidades = [];
521    $.getJSON('https://servicodados.ibge.gov.br/api/v1/localidades/municipios?orderBy=nome', function (itens) {
522      itens.map((item) => {
523        cidades.push({
524          municipio: item.nome,
525          id: item.id
526        });
527        // Com base no loop, é criado um option para cada cidade listada      
528        $('#nome-cidade').append($('<option value="' + item.nome + '">'));
529      });
530      // ID da cidade que será realizada a primeira consulta (Erechim) - Com base no geocode do IBGE
531      var id_principal = '4307005';
532      // Requisição ajax para consultar e preencher pela primeira vez os dados
533      $('#loading').fadeIn();
534      $.ajax({
535        type: "GET",
536        dataType: "json",
537        url: "https://apiprevmet3.inmet.gov.br/previsao/" + id_principal,
538        complete: function (data) {
539          $('#loading').fadeOut();
540          var previsao = data.responseJSON[id_principal];
541          var max;
542          var min;
543          var dia_semana;
544          var resumo;
545          var umidade_max;
546          var icone;
547          var uf;
548          var entidade;
549          for (key in previsao) {
550            if (previsao[key].manha != undefined) {
551              max = previsao[key].manha.temp_max;
552              min = previsao[key].manha.temp_min;
553              dia_semana = previsao[key].manha.dia_semana;
554              resumo = previsao[key].manha.resumo;
555              umidade_max = previsao[key].manha.umidade_max;
556              icone = previsao[key].manha.icone;
557              uf = previsao[key].manha.uf;
558              entidade = previsao[key].manha.entidade;
559            } else {
560              max = previsao[key].temp_max;
561              min = previsao[key].temp_min;
562              dia_semana = previsao[key].dia_semana;
563              resumo = previsao[key].resumo;
564              umidade_max = previsao[key].umidade_max;
565              icone = previsao[key].icone;
566              uf = previsao[key].uf;
567              entidade = previsao[key].entidade;
568            }
569            $('#weather').append($('<div class="day-square">' +
570              '<h5>' + dia_semana + '</h5>' +
571              '<p class="date"></p>' +
572              '<div class="max-min">' +
573              '<p class="min"><span>Min</span><br>' + min + 'º</p>' +
574              '<p class="max"><span>Máx</span><br>' + max + 'º</p>' +
575              '</div>' +
576              '<div class="icone"><img src="' + icone + '"></div>' +
577              '<div class="clima">' +
578              '<p class="condicao">' + resumo + '</p>' +
579              '<p class="uv"><span>Umidade máxima: ' + umidade_max + '%</span></p>' +
580              '</div>' +
581              '</div>')
582            );
583          }
584          $('#weather-location').append($('<h4>' + entidade + ' - ' + uf + '</h4>'));
585        }
586      });
587    });
588    // Requisição ajax ao clicar no botão de pesquisar por cidade
589    $('#weather-submit').click(function () {
590      var input = $('#weather-city').val();
591      $('.day-square').remove();
592      $('#weather-location h4').remove();
593      $('#loading').fadeIn();
594      cidades.map((item) => {
595        if (item.municipio == input) {
596          var sigla = item.municipio;
597          $.ajax({
598            type: "GET",
599            dataType: "json",
600            url: "https://apiprevmet3.inmet.gov.br/previsao/" + item.id,
601            complete: function (data) {
602              $('#loading').fadeOut();
603              var previsao = data.responseJSON[item.id];
604              var max;
605              var min;
606              var dia_semana;
607              var resumo;
608              var umidade_max;
609              var icone;
610              var uf;
611              var entidade;
612              for (key in previsao) {
613                if (previsao[key].manha != undefined) {
614                  max = previsao[key].manha.temp_max;
615                  min = previsao[key].manha.temp_min;
616                  dia_semana = previsao[key].manha.dia_semana;
617                  resumo = previsao[key].manha.resumo;
618                  umidade_max = previsao[key].manha.umidade_max;
619                  icone = previsao[key].manha.icone;
620                  uf = previsao[key].manha.uf;
621                  entidade = previsao[key].manha.entidade;
622                } else {
623                  max = previsao[key].temp_max;
624                  min = previsao[key].temp_min;
625                  dia_semana = previsao[key].dia_semana;
626                  resumo = previsao[key].resumo;
627                  umidade_max = previsao[key].umidade_max;
628                  icone = previsao[key].icone;
629                  uf = previsao[key].uf;
630                  entidade = previsao[key].entidade;
631                }
632                $('#weather').append($('<div class="day-square">' +
633                  '<h5>' + dia_semana + '</h5>' +
634                  '<p class="date"></p>' +
635                  '<div class="max-min">' +
636                  '<p class="min"><span>Min</span><br>' + min + 'º</p>' +
637                  '<p class="max"><span>Max</span><br>' + max + 'º</p>' +
638                  '</div>' +
639                  '<div class="icone"><img src="' + icone + '"></div>' +
640                  '<div class="clima">' +
641                  '<p class="condicao">' + resumo + '</p>' +
642                  '<p class="uv"><span>Umidade máxima: ' + umidade_max + '%</span></p>' +
643                  '</div>' +
644                  '</div>')
645                );
646              }
647              $('#weather-location').append($('<h4>' + entidade + ' - ' + uf + '</h4>'));
648            }
649          });
650        }
651      });
652    });
653    // FIM API PREVISÃO DO TEMPO
654    //Carregar mais posts página notícias
655    function load_posts() {
656      var ppp = $('#ver-mais-controller').data('ppp'); // Post per page
657      var pageNumber = $('#ver-mais-controller').data('page-number');
658      var categoryId = $('#ver-mais-controller').data('category');
659      var count = $('#ver-mais-controller').data('count');
660      var listados = $('#ver-mais-controller').data('listados');
661      var str = '&pageNumber=' + pageNumber + '&ppp=' + ppp + '&action=more_post_ajax' + '&categoryId=' + categoryId;
662
663      var contador = listados + ppp;
664      $('#loader-news').append('<div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div>');
665      $.ajax({
666        type: "POST",
667        dataType: "html",
668        url: "/wp-admin/admin-ajax.php",
669        data: str,
670        success: function (data) {
671          console.log(data)
672          var resp = JSON.parse(data);
673          console.log(resp)
674          if (resp.success) {
675            var html = resp.data;
676            if (html.length) {
677              pageNumber++;
678              $('#ver-mais-controller').data('listados', contador);
679              $('#ver-mais-controller').data('page-number', pageNumber);
680              $('#loader-news').empty();
681              $(".listar-posts").append(html);
682              $("#ver-mais-controller").attr("disabled", false);
683              if (contador >= count) {
684                $("#ver-mais-controller").hide();
685              }
686            } else {
687              $("#ver-mais-controller").attr("disabled", true);
688              $('#loader-news').empty();
689            }
690          } else {
691            console.log('não há mais posts');
692            $('#loader-news').empty();
693            $("#ver-mais-controller").hide();
694          }
695        },
696        error: function (jqXHR, textStatus, errorThrown) {
697          $loader.html(jqXHR + " :: " + textStatus + " :: " + errorThrown);
698          $('#loader-news').empty();
699        }
700      });
701      return false;
702    }
703    $("#ver-mais-controller").on("click", function () { // When btn is pressed.
704      load_posts();
705    });
706  });
707})(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.