website: turn the long feature list into a rail, and un-squish the text pages

**"And the rest of it"** was fourteen items as a two-column definition list — the
part of the page nobody finishes reading. It is now a horizontal rail of cards,
one icon each, tapping one opens the full paragraph in a dialog. Four of them
carry a link into the docs, where there is genuinely more to say: importing,
self-hosting, the MCP server and backups. Twelve new icons in the existing
sprite style (24x24, stroke 1.7) to go with it.

The dialog only ever shows text that is already in the card, so nothing is
hidden from a reader without JS: the cards are unclamped and fully readable, the
arrows stay hidden, and there is nothing to open. Arrows are for pointers that
cannot swipe and are dropped on touch.

**The docs and about pages were squished on a phone**, and it was one character:
`.prose` set `padding: <top> 0 0`, and the trailing zeros overwrote the left and
right padding `.wrap` had already set. On a desktop nothing showed, because 720px
of text has room to spare either way; on a phone the text ran into both edges of
the screen. Both pages share that class, which is why both looked wrong.

Two traps in the CSS I added and then found: `.frail-nav` and `.fdlg-go` both set
`display`, which beats the UA's `[hidden] { display: none }`. The arrows would
have shown without JS, and a card with no link would have shown a "read more"
pointing at whatever the previous card linked to. Both now honour the attribute.

Cache busters go to v=6 — the markup needs the new CSS and JS, and a returning
visitor holding v=5 would have got the new page with the old stylesheet.
This commit is contained in:
Duarte Santos committed 2026-08-25 22:39:04 +02:00
1 parent 3c985babea
commit 57ab683bf6
5 files changed
+267 -23

No files matched your search

+58
View File
@@ -176,3 +176,61 @@ const GL_PROJECT = 'https://gitlab.com/api/v4/projects/DuarteSantos8%2Fopengym'
}
} catch (e) { /* fallback entries stay */ }
})()
/* The "and the rest of it" rail: each card opens its own full text in a shared dialog, and
the arrows scroll the rail for pointers that cannot swipe. Everything the dialog shows is
read out of the card itself, so this only ever re-presents text that is already on the
page — with JS off the cards stay unclamped and there is nothing to open. */
;(() => {
const rail = document.querySelector('.frail')
const dlg = document.querySelector('.fdlg')
if (!rail || !dlg || typeof dlg.showModal !== 'function') return
const use = dlg.querySelector('.fdlg-ic use')
const title = dlg.querySelector('#fdlg-t')
const body = dlg.querySelector('.fdlg-b')
const go = dlg.querySelector('.fdlg-go')
rail.querySelectorAll('.fcard').forEach(card => {
card.addEventListener('click', () => {
const href = card.querySelector('.fcard-link')?.dataset.href
use.setAttribute('href', card.querySelector('.fcard-ic use').getAttribute('href'))
title.textContent = card.querySelector('.fcard-t').textContent
body.textContent = card.querySelector('.fcard-b').textContent
if (href) {
go.href = href
go.textContent = card.querySelector('.fcard-link').textContent + ' →'
go.hidden = false
} else {
go.hidden = true
}
dlg.showModal()
})
})
dlg.querySelector('.fdlg-x').addEventListener('click', () => dlg.close())
// Clicking the backdrop closes it: the click lands on the dialog itself, outside its box.
dlg.addEventListener('click', e => {
const r = dlg.getBoundingClientRect()
const inside = e.clientX >= r.left && e.clientX <= r.right && e.clientY >= r.top && e.clientY <= r.bottom
if (!inside) dlg.close()
})
const nav = document.querySelector('.frail-nav')
if (nav) {
nav.hidden = false
const [prev, next] = nav.querySelectorAll('.rnav')
const step = () => (rail.querySelector('.fcard')?.offsetWidth || 260) + 16
nav.addEventListener('click', e => {
const btn = e.target.closest('.rnav')
if (btn) rail.scrollBy({ left: Number(btn.dataset.dir) * step(), behavior: 'smooth' })
})
const sync = () => {
prev.disabled = rail.scrollLeft < 4
next.disabled = rail.scrollLeft > rail.scrollWidth - rail.clientWidth - 4
}
rail.addEventListener('scroll', sync, { passive: true })
addEventListener('resize', sync)
sync()
}
})()