Add Privacy Policy and Terms and Conditions pages for IDE Consultores
This commit is contained in:
+21
-12
@@ -1,6 +1,6 @@
|
||||
/* ==========================================================================
|
||||
ECOSISTEMA IDE — Cambio in-place + deep link por hash
|
||||
URLs válidas: #eco-excellence | #eco-projects | #eco-digital | #ecosistema
|
||||
URLs válidas: #eco-excellence | #eco-projects | #eco-digital | #ecosistema-ide
|
||||
========================================================================== */
|
||||
(function () {
|
||||
'use strict';
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
const VALID_UNITS = ['excellence', 'projects', 'digital'];
|
||||
const HASH_PREFIX = '#eco-';
|
||||
const HASH_ECOSYSTEM = '#ecosistema';
|
||||
const HASH_ECOSYSTEM = '#ecosistema-ide';
|
||||
|
||||
let lastFocusedTrigger = null;
|
||||
let currentUnit = null; // null = ecosistema
|
||||
@@ -63,13 +63,15 @@
|
||||
});
|
||||
|
||||
pills.forEach(pill => {
|
||||
pill.classList.toggle('is-active', pill.dataset.ecoOpen === id);
|
||||
const active = pill.dataset.ecoOpen === id;
|
||||
pill.classList.toggle('is-active', active);
|
||||
if (pill.tagName === 'BUTTON') pill.setAttribute('aria-pressed', active ? 'true' : 'false');
|
||||
});
|
||||
|
||||
const title = panel.querySelector('.eco-panel__title');
|
||||
if (title) {
|
||||
title.setAttribute('tabindex', '-1');
|
||||
requestAnimationFrame(() => title.focus({ preventScroll: false }));
|
||||
requestAnimationFrame(() => title.focus({ preventScroll: true }));
|
||||
}
|
||||
|
||||
currentUnit = id;
|
||||
@@ -80,7 +82,10 @@
|
||||
stateEcosystem.hidden = false;
|
||||
|
||||
triggers.forEach(t => t.setAttribute('aria-expanded', 'false'));
|
||||
pills.forEach(p => p.classList.remove('is-active'));
|
||||
pills.forEach(pill => {
|
||||
pill.classList.remove('is-active');
|
||||
if (pill.tagName === 'BUTTON') pill.setAttribute('aria-pressed', 'false');
|
||||
});
|
||||
|
||||
if (restoreFocus) {
|
||||
if (lastFocusedTrigger && typeof lastFocusedTrigger.focus === 'function') {
|
||||
@@ -93,6 +98,14 @@
|
||||
currentUnit = null;
|
||||
}
|
||||
|
||||
/* ---------- Scroll a la sección ---------- */
|
||||
function scrollToSection(behavior = 'smooth') {
|
||||
const rect = section.getBoundingClientRect();
|
||||
if (rect.top < -80 || rect.top > 200) {
|
||||
section.scrollIntoView({ behavior, block: 'start' });
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- API con URL ---------- */
|
||||
function openUnit(id, { push = true, scroll = true } = {}) {
|
||||
if (!VALID_UNITS.includes(id)) return;
|
||||
@@ -103,12 +116,7 @@
|
||||
history.pushState({ eco: id }, '', url);
|
||||
}
|
||||
|
||||
if (scroll) {
|
||||
const rect = section.getBoundingClientRect();
|
||||
if (rect.top < -80 || rect.top > 200) {
|
||||
section.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
}
|
||||
}
|
||||
if (scroll) scrollToSection('smooth');
|
||||
}
|
||||
|
||||
function closeUnit({ push = true, scroll = false } = {}) {
|
||||
@@ -127,7 +135,7 @@
|
||||
trigger.addEventListener('click', (e) => {
|
||||
const id = trigger.dataset.ecoOpen;
|
||||
if (!id) return;
|
||||
// Academy es <a href="academy.html">: dejamos navegar
|
||||
// Academy es <a href="ide-academy.html">: dejamos navegar
|
||||
if (trigger.tagName === 'A' && trigger.getAttribute('href')) return;
|
||||
e.preventDefault();
|
||||
openUnit(id);
|
||||
@@ -154,6 +162,7 @@
|
||||
const id = unitFromHash();
|
||||
if (id && id !== currentUnit) {
|
||||
renderUnit(id);
|
||||
scrollToSection('smooth');
|
||||
} else if (!id && currentUnit !== null) {
|
||||
renderEcosystem({ restoreFocus: false });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user