55 lines
1.9 KiB
Markdown
55 lines
1.9 KiB
Markdown
|
|
# typo
|
||
|
|
|
||
|
|
A typing test built from your own code. Every snippet is real, shipped
|
||
|
|
code pulled from real repos — flit, wisp, keep, stash, delve-term, goonk
|
||
|
|
itself — not generic pangrams or Lorem Ipsum.
|
||
|
|
|
||
|
|
No backend, no build step — plain HTML/CSS/JS served statically, with
|
||
|
|
snippets baked into `snippets.json`.
|
||
|
|
|
||
|
|
## Stats
|
||
|
|
|
||
|
|
- **WPM** — (correct characters / 5) / minutes elapsed, the standard
|
||
|
|
typing-test formula. Timing starts on the first keystroke, not page load.
|
||
|
|
- **Accuracy** — correct keystrokes / total keystrokes, including ones you
|
||
|
|
backspaced over. Tracked at the keydown level (comparing the pressed key
|
||
|
|
against the exact next expected character), not just diffed after the
|
||
|
|
fact.
|
||
|
|
- **Keys/sec** — total keystrokes / elapsed seconds, live.
|
||
|
|
|
||
|
|
Mistakes are highlighted in place rather than blocking progress — you can
|
||
|
|
backspace to fix them or keep going, same as most real typing tests.
|
||
|
|
Tabs in the original source are shown as two spaces so you never need to
|
||
|
|
press Tab.
|
||
|
|
|
||
|
|
## Adding snippets
|
||
|
|
|
||
|
|
Edit `snippets.json` — each entry is `{ repo, file, lang, code }`. Keep
|
||
|
|
snippets short (10-20 lines), self-contained, and free of exotic
|
||
|
|
Unicode in comments (em dashes etc. are typeable but annoying) if you
|
||
|
|
want them pleasant to type.
|
||
|
|
|
||
|
|
## Local development
|
||
|
|
|
||
|
|
Any static file server works, e.g.:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
python3 -m http.server 8850
|
||
|
|
```
|
||
|
|
|
||
|
|
## Status
|
||
|
|
|
||
|
|
Built and verified via simulated typing sessions (not just static
|
||
|
|
review): focus handling, live character-by-character highlighting,
|
||
|
|
newline handling for multi-line snippets, and the WPM/accuracy/KPS math
|
||
|
|
all confirmed against both artificially fast and realistic human-speed
|
||
|
|
input. Caught and fixed two real bugs in the process — a focus-stealing
|
||
|
|
issue caused by a stray `tabindex` on the code display, and a modal
|
||
|
|
overlay that was invisibly covering the whole page and intercepting
|
||
|
|
every click because its CSS unconditionally overrode the `hidden`
|
||
|
|
attribute.
|
||
|
|
|
||
|
|
## License
|
||
|
|
|
||
|
|
MIT.
|