This commit is contained in:
oliver
2026-08-28 10:10:31 -03:00
parent bbb746c06d
commit f533ff8e36
16 changed files with 0 additions and 3169 deletions
-59
View File
@@ -1,59 +0,0 @@
// Odoo Expertos — Main JavaScript
document.addEventListener('DOMContentLoaded', () => {
/* === Mobile Nav Toggle === */
const toggle = document.getElementById('navToggle');
const links = document.getElementById('navLinks');
if (toggle && links) {
toggle.addEventListener('click', () => {
links.classList.toggle('nav__links--open');
toggle.setAttribute('aria-expanded',
links.classList.contains('nav__links--open') ? 'true' : 'false'
);
});
links.querySelectorAll('.nav__link').forEach(link => {
link.addEventListener('click', () => {
links.classList.remove('nav__links--open');
toggle.setAttribute('aria-expanded', 'false');
});
});
}
/* === Highlight current nav link === */
const currentPath = window.location.pathname;
document.querySelectorAll('.nav__link').forEach(link => {
const href = link.getAttribute('href');
if (href && currentPath.startsWith(href) && href !== '/') {
link.classList.add('nav__link--active');
} else if (href === '/' && currentPath === '/') {
link.classList.add('nav__link--active');
}
});
/* === Smooth scroll for anchor links === */
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', e => {
const target = document.querySelector(anchor.getAttribute('href'));
if (target) {
e.preventDefault();
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
});
});
/* === Copy code blocks === */
document.querySelectorAll('pre').forEach(block => {
const btn = document.createElement('button');
btn.className = 'copy-btn';
btn.textContent = 'Copiar';
btn.setAttribute('aria-label', 'Copiar código');
block.appendChild(btn);
btn.addEventListener('click', async () => {
const code = block.querySelector('code');
if (code) {
await navigator.clipboard.writeText(code.textContent);
btn.textContent = 'Copiado';
setTimeout(() => { btn.textContent = 'Copiar'; }, 2000);
}
});
});
});