PageSourceSearch

https://acolweb.com.br/assets/js/home.js

js acolweb.com.br collected 2026-10-02 15:46:59 UTC 7,424 bytes, 199 lines download raw bytes

1const whatsappButton = document.getElementById('whatsappButton');
2
3setInterval(() => {
4    whatsappButton.classList.toggle('shake');
5}, 2000);
6
7// Função para verificar se o dispositivo é um celular
8function isMobileDevice() {
9    return (typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1);
10}
11
12// Função para ocultar a div em dispositivos móveis
13function ocultarEmCelular() {
14    var minhaDiv = document.getElementById("divImg");
15    var ahrefItem = document.getElementById("ahrefItem");
16    var minhaDiv2 = document.getElementById("divYoutube");
17
18    if (isMobileDevice()) {
19        minhaDiv.style.display = "none";
20        ahrefItem.style.display = "none";
21        minhaDiv2.style.display = "none";
22    }
23}
24
25// Chame a função ao carregar a página
26ocultarEmCelular();
27
28document.addEventListener("DOMContentLoaded", function () {
29
30    let lazyImages = [].slice.call(document.querySelectorAll("img.lazy"));
31
32    lazyImages.forEach(function (lazyImage) {
33        const img = new Image();
34        img.src = lazyImage.dataset.src;
35        img.onload = function () {
36            /* lazyImage.style.height = img.height + 'px';*/
37            lazyImage.classList.add('placeholder1');
38        };
39    });
40
41    if ("IntersectionObserver" in window) {
42        let lazyImageObserver = new IntersectionObserver(function (entries, observer) {
43            entries.forEach(function (entry) {
44                if (entry.isIntersecting) {
45                    let lazyImage = entry.target;
46                    lazyImage.src = lazyImage.dataset.src;
47                    lazyImage.classList.remove("lazy");
48                    lazyImageObserver.unobserve(lazyImage);
49                }
50            });
51        });
52
53        lazyImages.forEach(function (lazyImage) {
54            lazyImageObserver.observe(lazyImage);
55        });
56    } else {
57        // Fallback for browsers without IntersectionObserver
58        let active = false;
59
60        const lazyLoad = function () {
61            if (active === false) {
62                active = true;
63
64                setTimeout(function () {
65                    lazyImages.forEach(function (lazyImage) {
66                        if ((lazyImage.getBoundingClientRect().top <= window.innerHeight && lazyImage.getBoundingClientRect().bottom >= 0) && getComputedStyle(lazyImage).display !== "none") {
67                            lazyImage.src = lazyImage.dataset.src;
68                            lazyImage.classList.remove("lazy");
69
70                            lazyImages = lazyImages.filter(function (image) {
71                                return image !== lazyImage;
72                            });
73
74                            if (lazyImages.length === 0) {
75                                document.removeEventListener("scroll", lazyLoad);
76                                window.removeEventListener("resize", lazyLoad);
77                                window.removeEventListener("orientationchange", lazyLoad);
78                            }
79                        }
80                    });
81
82                    active = false;
83                }, 200);
84            }
85        };
86
87        document.addEventListener("scroll", lazyLoad);
88        window.addEventListener("resize", lazyLoad);
89        window.addEventListener("orientationchange", lazyLoad);
90    }
91});
92
93document.addEventListener('DOMContentLoaded', function () {
94    // Mobile menu toggle
95    const mobileMenuToggle = document.querySelector('.mobile-menu-toggle');
96    const mainNav = document.querySelector('.main-nav');
97
98    if (mobileMenuToggle && mainNav) {
99        mobileMenuToggle.addEventListener('click', function () {
100            this.classList.toggle('active');
101            mainNav.classList.toggle('active');
102
103            // Update ARIA attributes
104            const expanded = this.getAttribute('aria-expanded') === 'true' || false;
105            this.setAttribute('aria-expanded', !expanded);
106        });
107
108        // Close mobile menu when clicking outside
109        document.addEventListener('click', function (event) {
110            if (mainNav.classList.contains('active') &&
111                !event.target.closest('.header-content')) {
112                mainNav.classList.remove('active');
113                mobileMenuToggle.classList.remove('active');
114                mobileMenuToggle.setAttribute('aria-expanded', 'false');
115            }
116        });
117    }
118
119    // Scroll animations
120    const animateOnScroll = function () {
121        const elements = document.querySelectorAll('.feature-item, .benefit-item, .step-item');
122
123        elements.forEach(element => {
124            const elementPosition = element.getBoundingClientRect().top;
125            const windowHeight = window.innerHeight;
126
127            if (elementPosition < windowHeight - 100) {
128                element.classList.add('animate');
129            }
130        });
131    };
132
133    // Add animation classes
134    const style = document.createElement('style');
135    style.textContent = `
136        .feature-item, .benefit-item, .step-item {
137            opacity: 0;
138            transform: translateY(20px);
139            transition: opacity 0.6s ease, transform 0.6s ease;
140        }
141        
142        .feature-item.animate, .benefit-item.animate, .step-item.animate {
143            opacity: 1;
144            transform: translateY(0);
145        }
146    `;
147    document.head.appendChild(style);
148
149    // Run animation on load and scroll
150    window.addEventListener('load', animateOnScroll);
151    window.addEventListener('scroll', animateOnScroll);
152
153    // Set current year in footer
154    const yearElement = document.getElementById('current-year');
155    if (yearElement) {
156        yearElement.textContent = new Date().getFullYear();
157    }
158
159    // Add ARIA attributes to enhance accessibility
160    document.querySelectorAll('.feature-item').forEach((item, index) => {
161        item.setAttribute('aria-labelledby', `feature-heading-${index}`);
162        const heading = item.querySelector('h3');
163        if (heading) {
164            heading.id = `feature-heading-${index}`;
165        }
166    });
167
168    // Add structured data highlighting for search engines
169    document.querySelectorAll('strong').forEach(element => {
170        element.setAttribute('itemprop', 'text');
171    });
172
173    // Add table accessibility
174    document.querySelectorAll('table').forEach(table => {
175        table.setAttribute('role', 'table');
176        table.setAttribute('aria-label', 'Comparação entre gestão tradicional e gestão com IA');
177
178        const headers = table.querySelectorAll('th');
179        headers.forEach(header => {
180            header.setAttribute('scope', 'col');
181            header.setAttribute('role', 'columnheader');
182        });
183
184        const rows = table.querySelectorAll('tbody tr');
185        rows.forEach(row => {
186            row.setAttribute('role', 'row');
187            const firstCell = row.querySelector('td:first-child');
188            if (firstCell) {
189                firstCell.setAttribute('scope', 'row');
190                firstCell.setAttribute('role', 'rowheader');
191            }
192
193            const cells = row.querySelectorAll('td:not(:first-child)');
194            cells.forEach(cell => {
195                cell.setAttribute('role', 'cell');
196            });
197        });
198    });
199});

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.