delete
This commit is contained in:
-59
@@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user