PageSourceSearch

https://agenciabrasil.ebc.com.br/sites/default/files/js/js_Ah33anuaUzc7QUXyuZQApZOeTq9i1uWH36X5lchpQvw.js

js ebc.com.br collected 2026-09-24 08:24:16 UTC 8,503 bytes, 281 lines download raw bytes

1const menuBtnMob = document.getElementById('menu-btn-mob');
2const menuMobile = document.getElementById('nav-menu-mobile');
3const buscaBTN = document.getElementById('btn-busca');
4const searchTerm = document.getElementById('pesquisa-ebc');
5const searchBTN = document.getElementById('search-button');
6const headerSite = document.getElementById('header-site');
7const cabecalhoEBC = document.querySelector('.header-ebc');
8
9function toggleMenu(element) {
10  element.classList.toggle('open');
11}
12
13function openSearch() {
14  menuBtnMob.classList.add('open')
15}
16
17function openMenu(botao,elemento) {
18  toggleMenu(botao);
19  toggleMenu(elemento);
20}
21
22menuBtnMob.addEventListener("click", ()=> {
23  openMenu(menuBtnMob,menuMobile);
24})
25
26buscaBTN.addEventListener("click", () => {
27  openMenu(menuBtnMob,menuMobile);
28})
29
30//esconde header ebc ao descer na página - scroll
31function handleScroll() {
32  let distanciaEmPixels = 50;
33  if (window.scrollY > distanciaEmPixels) {
34    cabecalhoEBC.classList.add('esconde');
35    headerSite.classList.add('shadow');
36  } else {
37    cabecalhoEBC.classList.remove('esconde');
38    headerSite.classList.remove('shadow');
39  }
40}
41
42function checkWidthAndToggleScroll() {
43  // se estiver no desktop e usuário não estiver logado
44  if (window.innerWidth > 980 && !document.body.classList.contains('logged-in')) {
45    window.addEventListener('scroll', handleScroll);
46  } else {
47    window.removeEventListener('scroll', handleScroll);
48  }
49}
50
51// Verifica a largura ao carregar a página
52checkWidthAndToggleScroll();
53
54// Verifica a largura ao redimensionar a janela
55window.addEventListener('resize', checkWidthAndToggleScroll);
56
57//configuração da busca
58searchBTN.addEventListener('click', function() {
59  realizarBusca();
60});
61
62searchTerm.addEventListener('keypress', function(event) {
63  if (event.key === 'Enter') {
64    realizarBusca();
65  }
66});
67
68function realizarBusca() {
69
70  let searchTerm = document.getElementById('pesquisa-ebc').value;
71
72  if (searchTerm.trim() !== "") {
73    window.location.href = "https://busca.ebc.com.br?site_id=agenciabrasil&q=" + encodeURIComponent(searchTerm);
74  } else {
75    alert('Por favor, digite um termo para buscar.');
76  }
77}
78
79
80
81
82//botão continuar lendo na página da notícia na versão mobile
83// document.addEventListener("DOMContentLoaded", function() {
84  /*if (document.querySelector('.panel')) {
85    const btnContinuarLendo = document.getElementById('continuar-lendo');
86    const panel = document.getElementById('panel');
87
88    btnContinuarLendo.addEventListener('click', () => {
89      panel.classList.add('aberto');
90      btnContinuarLendo.classList.add('esconde');
91    });
92  } else {
93      return
94  }*/
95// });
96
97
98
99// extraido do arquivo: copiarUrl.js
100//função para copiar link do episódio
101const botoes = document.querySelectorAll('.sharing-btn');
102if (botoes) {
103  botoes.forEach(botao => {
104    botao.addEventListener('click', (e) => {
105      e.preventDefault();
106
107      const url = window.location.href;
108
109      navigator.clipboard.writeText(url)
110        .then(() => {
111          // Remove qualquer mensagem anterior
112          const wrapper = botao.parentElement;
113          const msgAnterior = wrapper.querySelector('.mensagem-copiado');
114          if (msgAnterior) msgAnterior.remove();
115
116          // Cria a mensagem
117          const mensagem = document.createElement('p');
118          mensagem.textContent = 'Link copiado!';
119          mensagem.classList.add('mensagem-copiado');
120
121          // Adiciona dentro do wrapper
122          wrapper.appendChild(mensagem);
123
124          // Remove depois de 3 segundos
125          setTimeout(() => {
126            mensagem.remove();
127          }, 3000);
128        })
129        .catch(err => {
130          console.error('Erro ao copiar o link:', err);
131        });
132    });
133  });
134}
135
136
137
138// extraido do arquivo: accordion-sobre.js
139document.addEventListener("DOMContentLoaded", () => {
140  const text = document.getElementById("text-podcast");
141  const button = document.getElementById("toggleButtonPodcast");
142  if (button) {
143    const arrow = button.querySelector(".arrow-btn-podcast");
144
145    // Garante que os "..." apareçam desde o início
146    text.classList.add("collapsed");
147
148    // Verifica se o texto ultrapassa duas linhas e então mostra o botão
149    function checkIfTruncatedPodcast() {
150      const lineHeight = parseFloat(getComputedStyle(text).lineHeight);
151      const maxLines = 3;
152      const maxVisibleHeight = lineHeight * maxLines;
153
154      if (text.scrollHeight > maxVisibleHeight + 1) {
155        button.style.display = "flex";
156      } else {
157        button.style.display = "none";
158      }
159    }
160
161    checkIfTruncatedPodcast();
162
163    window.addEventListener("resize", checkIfTruncatedPodcast);
164
165    button.addEventListener("click", () => {
166      if (!text.classList.contains("expanded")) {
167        button.classList.add("ativo");
168        text.style.maxHeight = text.scrollHeight + "px";
169        text.classList.remove("collapsed");
170        text.classList.add("expanded");
171      } else {
172        button.classList.remove("ativo");
173        text.style.maxHeight = text.scrollHeight + "px";
174        setTimeout(() => {
175          text.style.maxHeight = "4.8em";
176        }, 10);
177
178        setTimeout(() => {
179          text.classList.remove("expanded");
180          text.classList.add("collapsed");
181        }, 400);
182      }
183
184      arrow.classList.toggle("up");
185    });
186  }
187
188  // Seleciona o container de conteúdo
189  const container = document.querySelector(".conteudo-noticia");
190  if (!container) return; // Se não existir, sai do script
191
192  // Seleciona todos os iframes dentro do container
193  const iframes = container.querySelectorAll("iframe");
194
195  iframes.forEach(iframe => {
196    const src = iframe.getAttribute("src") || "";
197
198    // Verifica se é um embed do YouTube
199    if (src.includes("youtube.com/embed") || src.includes("youtu.be")) {
200      // Aplica o estilo responsivo
201      iframe.style.width = "100%";
202      iframe.style.aspectRatio = "16/9";
203      iframe.style.height = "auto";
204      iframe.style.border = "0";
205      iframe.style.maxWidth = "100%"; // garante que não estoure
206    }
207  });
208});
209;
210let clicks = 0;
211
212(function($) {
213    $(document).ready(function() {
214
215        const FONT_SIZE_ADJUST = 2;
216
217        $("button[class*='font-increase-event']").on('click', function() {
218            changeFontSize($(this), FONT_SIZE_ADJUST, +1);
219        });
220
221        $("button[class*='font-decrease-event']").on('click', function() {
222            changeFontSize($(this), FONT_SIZE_ADJUST*-1, -1)
223        });
224
225        $("a[class*='contrast-event']").on('click', function() {
226            let html = $('html');
227            html.toggleClass('contrast');
228            let c = getCookie();
229            c.contrast = html.hasClass('contrast');
230            setCookie(c)
231        });
232
233        const FONT_SIZE_TAGS = 'a, p, h1, h2, h3, h4';
234        const FONT_SIZE_CLICKS = 3;
235
236        function changeFontSize(element, size_adjust, clicks_adjust) {
237            if ((clicks + clicks_adjust) >= 0 && (clicks + clicks_adjust) <= FONT_SIZE_CLICKS) {
238                $('body').find(FONT_SIZE_TAGS).each(function() {
239                    $(this).css('font-size', parseInt($(this).css('font-size').replace('px', '')) + size_adjust);
240                });
241                clicks += clicks_adjust;
242                let c = getCookie();
243                c.clicks = clicks;
244                setCookie(c);
245            }
246        }
247
248        const COOKIE_NAME = 'agenciabrasil';
249        const COOKIE_DAYS = 1;
250
251        function setCookie(value) {
252            let d = new Date();
253            d.setTime(d.getTime() + (COOKIE_DAYS * 24 * 60 * 60 * 1000));
254            let expires = '; expires=' + d.toUTCString();
255            document.cookie = COOKIE_NAME + '=' + JSON.stringify(value) + expires + '; path=/';
256        }
257
258        function getCookie() {
259            let nameEQ = COOKIE_NAME + '=';
260            let ca = document.cookie.split(';');
261            for (let i = 0; i < ca.length; i++) {
262                let c = ca[i];
263                while (c.charAt(0) == ' ') c = c.substring(1, c.length);
264                if (c.indexOf(nameEQ) == 0) return JSON.parse(c.substring(nameEQ.length, c.length));
265            }
266            return null;
267        }
268
269        let c = getCookie();
270
271        if (c != null) {
272            // changeFontSize($(this), c.clicks * FONT_SIZE_ADJUST, c.clicks);
273            if (c.contrast == true) {
274                $('html').addClass('contrast');
275            }
276        } else {
277            setCookie({clicks: 0, contrast: false});
278        }
279    });
280})(jQuery);
281;

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.