PageSourceSearch

https://cigma.to.gov.br/static/js/layouts/landing/header.js

js cigma.to.gov.br collected 2026-10-06 21:37:43 UTC 2,699 bytes, 72 lines download raw bytes

1
2document.addEventListener('DOMContentLoaded', function () {
3    const mainNav = document.getElementById('main-nav');
4    const menuToggle = document.getElementById('menu-toggle');
5    const mobileMenu = document.getElementById('mobile-menu');
6    const menuIconOpen = document.getElementById('menu-icon-open');
7    const menuIconClosed = document.getElementById('menu-icon-closed');
8    const navLinks = document.querySelectorAll('.nav-link');
9
10    // Gerencia o efeito de scroll
11    window.addEventListener('scroll', function () {
12        if (window.scrollY > 10) {
13            mainNav.classList.add('scrolled');
14        } else {
15            mainNav.classList.remove('scrolled');
16        }
17    });
18
19    // Toggle do menu mobile
20    menuToggle.addEventListener('click', function () {
21        const expanded = menuToggle.getAttribute('aria-expanded') === 'true';
22        menuToggle.setAttribute('aria-expanded', !expanded);
23        mobileMenu.classList.toggle('hidden');
24
25        // Alterna os ícones
26        menuIconOpen.classList.toggle('hidden');
27        menuIconClosed.classList.toggle('hidden');
28    });
29
30    // Fecha o menu mobile ao clicar em um link
31    document.querySelectorAll('#mobile-menu a').forEach(link => {
32        link.addEventListener('click', function () {
33            mobileMenu.classList.add('hidden');
34            menuToggle.setAttribute('aria-expanded', 'false');
35            menuIconOpen.classList.add('hidden');
36            menuIconClosed.classList.remove('hidden');
37        });
38    });
39
40    // Destaca a seção ativa durante o scroll
41    function setActiveNav() {
42        const sections = ['', 'atribuicoes', 'funcionalidades', 'areas'];
43        let currentSectionIndex = 0;
44
45        // Encontra a seção atual baseada na posição de scroll
46        sections.forEach((section, index) => {
47            const el = section ? document.getElementById(section) : document.querySelector('header');
48            if (el) {
49                const rect = el.getBoundingClientRect();
50                if (rect.top <= 100 && rect.bottom >= 100) {
51                    currentSectionIndex = index;
52                }
53            }
54        });
55
56        // Remove a classe active de todos os links
57        navLinks.forEach(link => {
58            link.classList.remove('active');
59        });
60
61        // Adiciona a classe active ao link correspondente da seção atual
62        if (navLinks[currentSectionIndex]) {
63            navLinks[currentSectionIndex].classList.add('active');
64        }
65    }
66
67    // Adiciona o evento de scroll para atualizar a navegação ativa
68    window.addEventListener('scroll', setActiveNav);
69
70    // Define a navegação ativa inicialmente
71    setActiveNav();
72});

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.