- Cabecera: logotipo en SVG (src/assets/logo.svg) y favicon nuevo; barra de vidrio con subrayado que se dibuja de izquierda a derecha y separadores "/". - Hero: video de fondo optimizado (MP4 + WebM, póster webp de escritorio y móvil), velo para contraste AA, botón de pausa discreto, título "Collina Systems", altura 94svh y botón "Contacto" de vidrio blanco. - Banda marino "Construimos los sistemas con los que opera tu negocio." con enlace a /firma en celeste. - Sección de tarjetas por industria (fondo papel) en lugar de las cifras y el bloque de proyectos: fotos con <Picture> (avif/webp, 400/800/1200), alt y recorte en src/content/inicio/industrias.yaml publicados como /css/industrias.css (CSP sin estilos en línea); panel blanco al señalar con cursor, enlaces con subrayado animado. Enlaces a fichas por slug. - Nueva ficha "Cobranza al día" con diagrama; lo no documentado queda en TODO. - Eliminados Stat, la colección cifras y sus datos; verificar-metricas solo revisa fichas. - Pie nuevo portado de referencia/collina-footer: eslogan rotativo, correo, sedes con reloj por zona horaria, redes y copyright; estilos bajo .footer, colores como tokens, alineado a la retícula del sitio y eslogan mayor en teléfono. Sin la línea legal ni los enlaces del pie anterior. - CI movido a .gitea/workflows (Gitea Actions). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
120 lines
5.1 KiB
JavaScript
120 lines
5.1 KiB
JavaScript
/* ═══════════════════════════════════════════════════════════════════════
|
|
FOOTER · Collina Systems — comportamiento
|
|
1) Palabra rotativa del eslogan, con auto-ajuste de tamaño.
|
|
Se pausa fuera de pantalla y en pestañas ocultas; con movimiento
|
|
reducido no rota (se queda la primera palabra).
|
|
2) Relojes analógicos por zona horaria.
|
|
3) Año del copyright automático.
|
|
Cargar al final del <body> o con `defer`.
|
|
═══════════════════════════════════════════════════════════════════════ */
|
|
(function () {
|
|
var footer = document.querySelector('.footer');
|
|
if (!footer) return;
|
|
|
|
var reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
|
|
/* ── 1. Eslogan ───────────────────────────────────────────────────── */
|
|
var box = footer.querySelector('.footer__slogan-words');
|
|
var words = box ? Array.prototype.slice.call(box.querySelectorAll('.footer__slogan-word')) : [];
|
|
var line = footer.querySelector('.footer__slogan-line');
|
|
|
|
function fitWords() {
|
|
var width = box.clientWidth;
|
|
if (!width) return;
|
|
var REF = 200;
|
|
var widest = 0;
|
|
words.forEach(function (w) {
|
|
var prev = w.style.fontSize;
|
|
w.style.fontSize = REF + 'px';
|
|
widest = Math.max(widest, w.scrollWidth);
|
|
w.style.fontSize = prev;
|
|
});
|
|
if (!widest) return;
|
|
var lineSize = line ? parseFloat(getComputedStyle(line).fontSize) : Infinity;
|
|
var size = Math.min((width / widest) * REF, lineSize); // nunca más grande que CREAREMOS
|
|
words.forEach(function (w) { w.style.fontSize = size + 'px'; });
|
|
box.style.height = size + 'px';
|
|
}
|
|
|
|
if (words.length > 1) {
|
|
fitWords();
|
|
if ('ResizeObserver' in window) new ResizeObserver(fitWords).observe(box);
|
|
else window.addEventListener('resize', fitWords);
|
|
if (document.fonts && document.fonts.ready) document.fonts.ready.then(fitWords);
|
|
|
|
var INTERVAL = 2400;
|
|
var TRANSITION = 600;
|
|
var idx = 0;
|
|
var timer = null;
|
|
var visible = false;
|
|
|
|
function next() {
|
|
var current = words[idx];
|
|
idx = (idx + 1) % words.length;
|
|
var upcoming = words[idx];
|
|
current.removeAttribute('data-active');
|
|
current.setAttribute('data-leaving', 'true');
|
|
upcoming.removeAttribute('data-leaving');
|
|
void upcoming.offsetWidth;
|
|
upcoming.setAttribute('data-active', 'true');
|
|
window.setTimeout(function () { current.removeAttribute('data-leaving'); }, TRANSITION + 50);
|
|
}
|
|
function sync() {
|
|
var run = visible && !document.hidden && !reduceMotion.matches;
|
|
if (run && !timer) timer = window.setInterval(next, INTERVAL);
|
|
if (!run && timer) { window.clearInterval(timer); timer = null; }
|
|
}
|
|
|
|
if ('IntersectionObserver' in window) {
|
|
new IntersectionObserver(function (entries) {
|
|
visible = entries[0].isIntersecting;
|
|
sync();
|
|
}).observe(box);
|
|
} else {
|
|
visible = true;
|
|
}
|
|
document.addEventListener('visibilitychange', sync);
|
|
if (reduceMotion.addEventListener) reduceMotion.addEventListener('change', sync);
|
|
sync();
|
|
}
|
|
|
|
/* ── 2. Relojes ───────────────────────────────────────────────────── */
|
|
var branches = Array.prototype.slice.call(footer.querySelectorAll('.footer__branch[data-tz]'));
|
|
|
|
function timeIn(tz) {
|
|
try {
|
|
var parts = new Intl.DateTimeFormat('en-US', {
|
|
timeZone: tz, hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit'
|
|
}).formatToParts(new Date());
|
|
var t = { h: 0, m: 0, s: 0 };
|
|
parts.forEach(function (p) {
|
|
if (p.type === 'hour') t.h = parseInt(p.value, 10) % 24;
|
|
if (p.type === 'minute') t.m = parseInt(p.value, 10);
|
|
if (p.type === 'second') t.s = parseInt(p.value, 10);
|
|
});
|
|
return t;
|
|
} catch (e) {
|
|
var d = new Date();
|
|
return { h: d.getHours(), m: d.getMinutes(), s: d.getSeconds() };
|
|
}
|
|
}
|
|
|
|
function tick() {
|
|
branches.forEach(function (b) {
|
|
var t = timeIn(b.getAttribute('data-tz'));
|
|
var hour = b.querySelector('.footer__clock-hand--hour');
|
|
var minute = b.querySelector('.footer__clock-hand--minute');
|
|
if (hour) hour.style.transform = 'rotate(' + (((t.h % 12) + t.m / 60) * 30).toFixed(2) + 'deg)';
|
|
if (minute) minute.style.transform = 'rotate(' + ((t.m + t.s / 60) * 6).toFixed(2) + 'deg)';
|
|
});
|
|
}
|
|
if (branches.length) {
|
|
tick();
|
|
window.setInterval(tick, 15000);
|
|
}
|
|
|
|
/* ── 3. Año ───────────────────────────────────────────────────────── */
|
|
var year = footer.querySelector('[data-footer-year]');
|
|
if (year) year.textContent = new Date().getFullYear();
|
|
})();
|