/* ── THE THREE STAGES, ON A PHONE ───────────────────────────────────────── * * Dr KC, 29 August 2026, on a screen recording of this section on his own * phone: "For the mobile version, we can make the content more simplify. Not * need to display 100% all the information." * * And Taufik, with the diagnosis: "current one is quite laggy and too * dependent of phone spec and connection. maybe can make it like the mileston * of mobile version, the click will pop up and got cards scroll down." * * ── WHAT THE RECORDING ACTUALLY SHOWED ─────────────────────────────────── * * Not slowness. All THREE stages painted on top of each other — "Simplified * Access" printed through "Dash camera", "NEUFactory" through "ON THE LINE", * every word unreadable. Then a screen and a half of empty black, and a * low-battery warning at 20%. * * The cause is the design, not the phone. On a desktop the stages cross-fade: * `showStep` runs on a scroll frame, swaps `.is-on`, and a 0.4s opacity and * visibility transition carries one out as the next comes in. On a phone * being throttled — his was in power saving — scroll frames arrive faster * than the transitions can finish, so each new frame restarts a fade that * never completes and nothing is ever fully hidden. It cannot be tuned out; * a slower phone just piles up more of them. * * So a phone does not do it at all. Three still cards, a swipe, and a tap * opens the stage in the same panel the rest of the site uses. * * ── AND THE MEGABYTE ── * * `teach-robot.mp4` is 1.02 MB with `preload="auto"`, and it is SEEKED on * every scroll frame. That is the "dependent on connection" half of Taufik's * sentence, and scrollfilm.js now leaves it alone on a phone entirely — the * poster frame is all a phone ever fetches. */ (function () { var cards = document.querySelector('[data-tcards]'); var pop = document.querySelector('[data-tpop]'); if (!cards || !pop) return; var panel = pop.querySelector('[data-arrive-panel]'); var body = pop.querySelector('[data-tpopbody]'); var elN = pop.querySelector('[data-tpopn]'); var elTitle = pop.querySelector('[data-tpoptitle]'); var cols = [].slice.call(document.querySelectorAll('.teach3__col')); /* WHERE THE STAGE CAME FROM, so it can go back. The stage is MOVED here rather than copied: one copy in the page means the words can never be edited in one place and stale in the other, and it is also how the live ball in stage 2 keeps whatever state it had. */ var home = null, homeNext = null, openIndex = -1, busy = false; function put(i) { var col = cols[i]; if (!col) return; home = col.parentNode; homeNext = col.nextSibling; body.appendChild(col); /* it is absolutely positioned and hidden in the pinned stage it came from; in here it is simply the content */ col.classList.add('is-inpop'); } function giveBack() { if (!home) return; var col = body.firstElementChild; if (col) { col.classList.remove('is-inpop'); home.insertBefore(col, homeNext); } home = null; homeNext = null; } function shut() { if (busy || pop.hidden) return; busy = true; var done = function () { giveBack(); pop.hidden = true; busy = false; var back = cards.querySelector('[data-tcard="' + openIndex + '"]'); if (back) back.focus(); openIndex = -1; }; if (window.NEUArrive) window.NEUArrive.close({ root: pop, panel: panel, done: done }); else done(); } cards.querySelectorAll('[data-tcard]').forEach(function (b) { b.addEventListener('click', function () { if (busy || !pop.hidden) return; var i = Number(b.getAttribute('data-tcard')); openIndex = i; var name = b.querySelector('.tcard__name'); var num = b.querySelector('.tcard__n'); elTitle.textContent = name ? name.textContent : ''; elN.textContent = num ? num.textContent : ''; busy = true; var fill = function () { body.innerHTML = ''; put(i); }; if (window.NEUArrive) { window.NEUArrive.open({ from: b, root: pop, panel: panel, fill: fill, done: function () { busy = false; var x = pop.querySelector('.tpop__x'); if (x) x.focus(); }, }); } else { /* no arrival script — be there, plainly, rather than not at all */ fill(); pop.hidden = false; pop.classList.add('is-veiled', 'is-here'); busy = false; } }); }); pop.querySelectorAll('[data-tpopclose]').forEach(function (b) { b.addEventListener('click', shut); }); document.addEventListener('keydown', function (e) { if (e.key === 'Escape' && !pop.hidden) shut(); }); })();