PageSourceSearch

https://www.cps.sp.gov.br/wp-content/themes/tema-cps/js/scripts.js?ver=1744305351

js cps.sp.gov.br collected 2026-09-24 08:58:08 UTC 12,946 bytes, 422 lines download raw bytes

1/*---------- INICIO Funcionalidade do menu mobile ----------*/
2window.addEventListener("load", function (event) {
3  var acc = document.getElementsByClassName("accordion");
4  var i;
5
6  for (i = 0; i < acc.length; i++) {
7    acc[i].addEventListener("click", function () {
8      /* Toggle between adding and removing the "active" class,
9      to highlight the button that controls the panel */
10      this.classList.toggle("active");
11
12      /* Toggle between hiding and showing the active panel */
13      var panel = this.nextElementSibling;
14      if (panel.style.display === "block") {
15        panel.style.display = "none";
16      } else {
17        panel.style.display = "block";
18      }
19    });
20  }
21  var menusComSubItems = document.querySelectorAll(".menu-item-has-children");
22
23  if (window.innerWidth >= 1024) {
24    for (var i = 0; i < menusComSubItems.length; i++) {
25      if (menusComSubItems[i].classList.contains("has-mega-menu")) {
26        menusComSubItems[i].classList.remove("menu-item-has-children");
27      }
28    }
29  }
30
31  if (window.innerWidth < 1024) {
32    for (var i = 0; i < menusComSubItems.length; i++) {
33      menusComSubItems[i].addEventListener("click", function () {
34        this.children[1].classList.add("sub-menu-ativo");
35        //console.log("clicou");
36      });
37    }
38  }
39
40  const btnAbreMenu = document.querySelector("#menu-mobile__btn");
41  const btnFechaMenu = document.querySelector(
42    ".main-menu-container i.fa-times"
43  );
44  const menuContainer = document.querySelector(".main-menu-container");
45
46  btnAbreMenu.addEventListener("click", function () {
47    menuContainer.style.display = "block";
48  });
49
50  btnFechaMenu.addEventListener("click", function () {
51    menuContainer.style.display = "none";
52  });
53});
54/*---------- FIM Funcionalidade do menu mobile ----------*/
55
56/*---------- INICIO Funcionalidade do Slider de imagens ----------*/
57
58//   const sliderInova = document.querySelector(".post-slider__container");
59//   const controleDireita = document.querySelector("#controle-direita");
60//   const controleEsquerda = document.querySelector("#controle-esquerda");
61//   const larguraItem = document.querySelector(".item").offsetWidth;
62
63//   setInterval(() => {
64//     if (sliderInova.scrollLeft === (sliderInova.scrollWidth - larguraItem)) {
65//      sliderInova.scrollBy(-sliderInova.scrollWidth, 0);
66//    } else {
67//      sliderInova.scrollBy(larguraItem, 0);
68//    }
69//  }, 1000);
700;
71//   controleDireita.addEventListener("click", function() {
72//     sliderInova.scrollBy(larguraItem, 0);
73//   } )
74//   controleEsquerda.addEventListener("click", function() {
75//     sliderInova.scrollBy(-larguraItem, 0);
76//   } )
77
78//---//
79
80if (document.querySelector("#post-slider__container")) {
81  let tempoTransicao = 7000,
82    indexItemAtual = 0,
83    items = document.querySelectorAll("#post-slider__container .item");
84  totalItems = items.length;
85
86  function proximoItem() {
87    //console.log(totalItems);
88    //console.log(items[indexItemAtual]);
89    items[indexItemAtual].classList.remove("ativo");
90
91    indexItemAtual === totalItems - 1 ? (indexItemAtual = 0) : indexItemAtual++;
92
93    items[indexItemAtual].classList.add("ativo");
94  }
95
96  function itemAnterior() {
97    items[indexItemAtual].classList.remove("ativo");
98
99    if (indexItemAtual === 0) indexItemAtual = totalItems;
100
101    indexItemAtual--;
102
103    items[indexItemAtual].classList.add("ativo");
104  }
105
106  function iniciarSlider() {
107    setInterval(() => {
108      // troca de image
109      proximoItem();
110    }, tempoTransicao);
111  }
112
113  const controleEsquerda = document.querySelector("#controle-esquerda");
114  const controleDireita = document.querySelector("#controle-direita");
115
116  controleDireita.addEventListener("click", () => {
117    proximoItem();
118  });
119
120  controleEsquerda.addEventListener("click", () => {
121    itemAnterior();
122  });
123
124  window.addEventListener("load", iniciarSlider);
125}
126//---//
127
128/**
129 * Esconde Eventos com registro encerrado no site Inova CPS
130 */
131if (window.location.href === "https://inova.cps.sp.gov.br/academia-inovacps/") {
132  const todosEventos = document.querySelectorAll(".qem");
133
134  for (i = 0; i <= todosEventos.length - 1; i++) {
135    if (
136      todosEventos[i].children[1].children[5].innerText ===
137        "RESERVAS ENCERRADAS" ||
138      todosEventos[i].children[1].children[4].innerText ===
139        "RESERVAS ENCERRADAS"
140    ) {
141      todosEventos[i].style.display = "none";
142    }
143  }
144}
145
146const popupContainer = document.querySelector(".popup-cf7-enviado__container");
147const popupBtnFechar = document.querySelector(
148  ".popup-cf7-enviado__conteudo .fa-times-circle"
149);
150
151//popupBtnFechar.addEventListener("click", () => {
152  //popupContainer.style.display = "none";
153//});
154
155/*---------- FIM Funcionalidade do Slider de imagens ----------*/
156
157/*---------- INICIO Abrir todos os links do site em uma nova aba ----------*/
158const links = document.querySelectorAll(".single-post .cps-texto-conteudo a");
159const len = links.length;
160
161for (let i = 0; i < len; i++) {
162  links[i].target = "_blank";
163  links[i].rel = "noreferrer noopener";
164}
165
166const linkspagination = document.querySelectorAll(".single-post .notarget a");
167const lens = linkspaginatio.length;
168
169for (let i = 0; i < lens; i++) {
170  linkspaginatio[i].target = "_self";
171  linkspaginatio[i].rel = "noreferrer noopener";
172}
173/*---------- INICIO Abrir todos os links do site em uma nova aba ----------*/
174// const inputTeste = document.querySelector("#pesquisa-teste");
175
176// if (inputTeste) {
177//   inputTeste.addEventListener("keyup", function (element) {
178//     const termoDeBusca = element.target.value;
179
180//     fetch(
181//       `http://localhost:8080/master/wp-json/cps/v1/cursos?search=${termoDeBusca}`
182//     )
183//       .then((response) => response.json())
184//       .then((response) => {
185//         console.log(response);
186//       });
187//   });
188// }
189
190(function ($) {
191  const inputDeBusca = $("#pesquisa-cursos-etec");
192  let timerPesquisa = "";
193  let pesquisaAnterior;
194
195  inputDeBusca.on("keyup", pegaResultadosDeBusca);
196
197  function pegaResultadosDeBusca(element) {
198    if (element.target.value != pesquisaAnterior) {
199      clearTimeout(timerPesquisa);
200
201      if (element.target.value) {
202        timerPesquisa = setTimeout(function () {
203          $(".cursos-etec").html(
204            '<br><strong>Carregando</strong> <i class="fas fa-circle-notch fa-spin"></i>'
205          );
206
207          $.getJSON(
208            `https://www.cps.sp.gov.br/wp-json/wp/v2/cursos-etec?search=${element.target.value}&per_page=100`,
209            function (results) {
210              if (results.length > 0) {
211                $(".cursos-etec").html(`
212                  <hr>
213                  <h4>Resultados de busca para: ${element.target.value}</h4>
214              `);
215
216                results.map((result) => {
217                  $(".cursos-etec").append(`
218                  <a href="${result.link}">${result.title.rendered}</a><br>
219                `);
220                });
221              } else {
222                $(".cursos-etec").html(`
223                <hr>
224                <h5>Nenhum resultado de busca encontrado.</h5>
225              `);
226              }
227            }
228          );
229        }, 200);
230      } else {
231        $(".cursos-etec").html("");
232      }
233    }
234
235    pesquisaAnterior = element.target.value;
236  }
237})(jQuery);
238
239(function ($) {
240  const inputDeBusca = $("#pesquisa-unidades-etec");
241  let timerPesquisa = "";
242  let pesquisaAnterior;
243
244  inputDeBusca.on("keyup", pegaResultadosDeBuscaEtecs);
245
246  function pegaResultadosDeBuscaEtecs(element) {
247    if (element.target.value != pesquisaAnterior) {
248      clearTimeout(timerPesquisa);
249
250      if (element.target.value) {
251        timerPesquisa = setTimeout(function () {
252          $(".unidades-etec").html(
253            '<br><strong>Carregando</strong> <i class="fas fa-circle-notch fa-spin"></i>'
254          );
255
256          $.getJSON(
257            `https://www.cps.sp.gov.br/wp-json/wp/v2/etecs?search=${element.target.value}&per_page=100`,
258            function (results) {
259              if (results.length > 0) {
260                $(".unidades-etec").html(`
261                  <hr>
262                  <h4>Resultados de busca para: ${element.target.value}</h4>
263              `);
264
265                results.map((result) => {
266                  $(".unidades-etec").append(`
267                  <a href="${result.link}">${result.title.rendered}</a><br>
268                `);
269                });
270              } else {
271                $(".unidades-etec").html(`
272                <hr>
273                <h5>Nenhum resultado de busca encontrado.</h5>
274              `);
275              }
276            }
277          );
278        }, 200);
279      } else {
280        $(".unidades-etec").html("");
281      }
282    }
283
284    pesquisaAnterior = element.target.value;
285  }
286})(jQuery);
287
288// Pesquisas Fatec
289
290(function ($) {
291  const inputDeBusca = $("#pesquisa-cursos-fatec");
292  let timerPesquisa = "";
293  let pesquisaAnterior;
294
295  inputDeBusca.on("keyup", pegaResultadosDeBusca);
296
297  function pegaResultadosDeBusca(element) {
298    if (element.target.value != pesquisaAnterior) {
299      clearTimeout(timerPesquisa);
300
301      if (element.target.value) {
302        timerPesquisa = setTimeout(function () {
303          $(".cursos-fatec").html(
304            '<br><strong>Carregando</strong> <i class="fas fa-circle-notch fa-spin"></i>'
305          );
306
307          $.getJSON(
308            `https://www.cps.sp.gov.br/wp-json/wp/v2/cursos-fatec?search=${element.target.value}&per_page=100`,
309            function (results) {
310              if (results.length > 0) {
311                $(".cursos-fatec").html(`
312                  <hr>
313                  <h4>Resultados de busca para: ${element.target.value}</h4>
314              `);
315
316                results.map((result) => {
317                  $(".cursos-fatec").append(`
318                  <a href="${result.link}">${result.title.rendered}</a><br>
319                `);
320                });
321              } else {
322                $(".cursos-fatec").html(`
323                <hr>
324                <h5>Nenhum resultado de busca encontrado.</h5>
325              `);
326              }
327            }
328          );
329        }, 200);
330      } else {
331        $(".cursos-fatec").html("");
332      }
333    }
334    pesquisaAnterior = element.target.value;
335  }
336})(jQuery);
337
338(function ($) {
339  const inputDeBusca = $("#pesquisa-unidades-fatec");
340  let timerPesquisa = "";
341  let pesquisaAnterior;
342
343  inputDeBusca.on("keyup", pegaResultadosDeBuscaFatecs);
344
345  function pegaResultadosDeBuscaFatecs(element) {
346    if (element.target.value != pesquisaAnterior) {
347      clearTimeout(timerPesquisa);
348
349      if (element.target.value) {
350        timerPesquisa = setTimeout(function () {
351          $(".unidades-fatec").html(
352            '<br><strong>Carregando</strong> <i class="fas fa-circle-notch fa-spin"></i>'
353          );
354
355          $.getJSON(
356            `https://www.cps.sp.gov.br/wp-json/wp/v2/fatecs?search=${element.target.value}&per_page=100`,
357            function (results) {
358              if (results.length > 0) {
359                $(".unidades-fatec").html(`
360                  <hr>
361                  <h4>Resultados de busca para: ${element.target.value}</h4>
362              `);
363
364                results.map((result) => {
365                  $(".unidades-fatec").append(`
366                  <a href="${result.link}">${result.title.rendered}</a><br>
367                `);
368                });
369              } else {
370                $(".unidades-fatec").html(`
371                <hr>
372                <h5>Nenhum resultado de busca encontrado.</h5>
373              `);
374              }
375            }
376          );
377        }, 200);
378      } else {
379        $(".unidades-fatec").html("");
380      }
381    }
382
383    pesquisaAnterior = element.target.value;
384  }
385})(jQuery);
386
387// (function ($) {
388//   const listagemFontesInfo = $("#listagem-fontes-informacao");
389
390//   window.addEventListener("load", carregaFontesInformacao);
391
392//   function carregaFontesInformacao() {
393//     listagemFontesInfo.html(
394//       '<br><strong>Carregando</strong> <i class="fas fa-circle-notch fa-spin"></i>'
395//     );
396
397//     $.getJSON(
398//       `http://sites-cpsnew-homologacao.azurewebsites.net/cgd/wp-json/wp/v2/cgd-fontes-info`,
399//       function (results) {
400//         if (results.length > 0) {
401//           console.log(results);
402//           listagemFontesInfo.html("");
403//           results.map((result) => {
404//             listagemFontesInfo.append(`
405//             <a href="${result.acf.endereco_de_acesso}">${result.title.rendered} - (${result.acf.titulo})</a><br>
406//             <p>Autor: ${result.acf.autoria} | Eixo Tecnológico: ${result.acf.eixo_tecnologico}</p>
407//             <p>Fonte ${result.acf.fonte[0]} | Tipo de Fonte: ${result.acf.tipo_de_fonte}</p>
408//             <p>Resumo:</p>
409//             <p>${result.acf.resumo}</p>
410//             <hr>
411//           `);
412//           });
413//         } else {
414//           listagemFontesInfo.html(`
415//           <hr>
416//           <h5>Nenhum resultado de busca encontrado.</h5>
417//         `);
418//         }
419//       }
420//     );
421//   }
422// })(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.