Demo con contador de pasos e icono de detener, horas de sesión coherentes, IDs de sesión sin choques, URLs bloqueadas inertes, recortes de importación contados y sesionAGuion con deshacer
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9a5f21badf
commit
c0b7d0c2ce
+43
-3
@@ -74,15 +74,55 @@ window.WAM = window.WAM || {};
|
||||
|
||||
/* ————————————————— botón "Reproducir demo" ————————————————— */
|
||||
|
||||
var SVG_STOP = '<rect x="6.5" y="6.5" width="11" height="11" rx="2"/>';
|
||||
|
||||
/* Contador discreto «Paso 3/12» junto al botón (se crea una vez). */
|
||||
function contadorDemo(btn) {
|
||||
var c = porId("demo-paso");
|
||||
if (c) return c;
|
||||
c = document.createElement("span");
|
||||
c.id = "demo-paso";
|
||||
c.className = "demo-paso";
|
||||
c.setAttribute("aria-live", "polite");
|
||||
c.setAttribute("role", "status");
|
||||
c.hidden = true;
|
||||
/* estilo mínimo en línea (tabular) mientras no haya regla en iphone.css */
|
||||
c.style.fontSize = "12px";
|
||||
c.style.fontVariantNumeric = "tabular-nums";
|
||||
c.style.opacity = "0.75";
|
||||
c.style.whiteSpace = "nowrap";
|
||||
btn.parentNode.insertBefore(c, btn);
|
||||
return c;
|
||||
}
|
||||
|
||||
function pintarBotonDemo() {
|
||||
var btn = porId("btn-reproducir");
|
||||
if (!btn) return;
|
||||
var activa = WAM.demoActiva();
|
||||
btn.setAttribute("aria-pressed", activa ? "true" : "false");
|
||||
var svg = btn.querySelector("svg");
|
||||
if (svg) {
|
||||
if (!svg.dataset.play) svg.dataset.play = svg.innerHTML;
|
||||
var deseado = activa ? SVG_STOP : svg.dataset.play;
|
||||
if (svg.innerHTML !== deseado) svg.innerHTML = deseado;
|
||||
}
|
||||
var span = btn.querySelector("span");
|
||||
if (!span) return;
|
||||
if (!span.dataset.etiqueta) span.dataset.etiqueta = span.textContent;
|
||||
span.textContent = activa ? "■ Detener" : span.dataset.etiqueta;
|
||||
if (span) {
|
||||
if (!span.dataset.etiqueta) span.dataset.etiqueta = span.textContent;
|
||||
span.textContent = activa ? "Detener" : span.dataset.etiqueta;
|
||||
}
|
||||
if (btn.parentNode) {
|
||||
var c = contadorDemo(btn);
|
||||
var p = typeof WAM.progresoDemo === "function" ? WAM.progresoDemo() : null;
|
||||
if (activa && p && p.total > 0 && p.paso > 0) {
|
||||
var txt = "Paso " + p.paso + "/" + p.total;
|
||||
if (c.textContent !== txt) c.textContent = txt;
|
||||
c.hidden = false;
|
||||
} else {
|
||||
c.hidden = true;
|
||||
c.textContent = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Evita que un doble clic arranque y detenga la demo en el mismo gesto. */
|
||||
|
||||
Reference in New Issue
Block a user