oficina / docs Public

Clone
git clone https://amadan.net/oficina/docs

Plain git — no account needed to clone.

Download

Download this file

1// fixtures/fonts-hold.js — the first thing a document page runs, before
2// it has painted anything (a plain <script> in <head>, after the font
3// stylesheet).
4//
5// It turns the hold on: the sheet and the font control are hidden until
6// fonts-gate.mjs has their faces (NO-FOUT.md §2). The hold is set here,
7// by script, and not rendered by the server, so that a reader without
8// JavaScript, or one whose script never arrives, is never held: they get
9// the system faces from the first paint, and the stylesheet uses no web
10// face unless the gate has turned the web faces on. Nothing to wait for,
11// nothing to swap (branch review findings 4 and 7).
12//
13// And a fail-safe the gate cannot take down with it: if the gate has not
14// taken over by FAILSAFE_MS (its own script failed to load, say), the
15// page is shown as it stands, in its system faces, and its layout is
16// frozen for the visit so a late editor cannot repaginate it.
17;(function () {
18 var FAILSAFE_MS = 6000
19 var root = document.documentElement
20 root.setAttribute('data-docs-fonts', 'pending')
21 root.setAttribute('data-docs-previews', 'pending')
22 globalThis.__docsFontsHold = setTimeout(function () {
23 if (root.getAttribute('data-docs-fonts') === 'pending') {
24 root.setAttribute('data-docs-layout', 'frozen')
25 root.setAttribute('data-docs-fonts', 'shown')
26 }
27 if (root.getAttribute('data-docs-previews') === 'pending') root.setAttribute('data-docs-previews', 'system')
28 }, FAILSAFE_MS)
29})()
30