| 1 | // fixtures/fonts-hold.js — the first thing a slide surface runs, before |
| 2 | // it has painted anything: a plain, blocking <script> in <head>, after |
| 3 | // <meta name="slides-fonts"> (layout.html's font-head). Built as an IIFE |
| 4 | // into internal/slides/static/fontshold.<hash>.js. |
| 5 | // |
| 6 | // It turns the hold on: <html data-slides-fonts="pending">, which |
| 7 | // slides.css answers by hiding every slide (visibility, so the page's |
| 8 | // layout is already final underneath) until fonts-gate.mjs has the |
| 9 | // deck's families and shows them, once. The hold is set here, by script, |
| 10 | // and never rendered by the server, so a reader without JavaScript, or |
| 11 | // one whose script never arrives, is never held: no stylesheet declares |
| 12 | // a web face, so their slides are in the system faces from the first |
| 13 | // paint, and stay there. |
| 14 | // |
| 15 | // And a fail-safe the gate cannot take down with it: if the gate has not |
| 16 | // taken over by FAILSAFE_MS (its own script failed to load, say), the |
| 17 | // page is shown as it stands, in its system faces, and the gate, should |
| 18 | // it arrive after all, turns nothing on. |
| 19 | ;(function () { |
| 20 | var FAILSAFE_MS = 6000 |
| 21 | var root = document.documentElement |
| 22 | if (!document.querySelector('meta[name="slides-fonts"]')) return |
| 23 | root.setAttribute('data-slides-fonts', 'pending') |
| 24 | globalThis.__slidesFontsHold = setTimeout(function () { |
| 25 | if (root.getAttribute('data-slides-fonts') === 'pending') root.setAttribute('data-slides-fonts', 'shown') |
| 26 | }, FAILSAFE_MS) |
| 27 | })() |
| 28 | |