/* math_copy.js — click-to-copy LaTeX source for IHUFT display equations.
*
* Every display equation produced by hooks/math_prerender.py is wrapped in
*
*
* … pre-rendered KaTeX HTML …
*
*
*
* This script attaches a single delegated click/keyboard handler to the
* document and, when the user activates a .math-copy button, reads the
* `data-latex` attribute from the surrounding .math-display, copies it to
* the system clipboard, and toggles the .is-copied class on the button
* for ~1.2 s so the CSS (see docs/stylesheets/extra.css) can swap the
* clipboard glyph for a check mark and the "Copy LaTeX" tooltip for
* "Copied!".
*
* Graceful degradation:
* • Without JS at all → math still renders perfectly; the button is
* simply inert; LaTeX source remains recoverable from the MathML
* element and the data-latex attribute via DevTools.
* • Without navigator.clipboard (older browsers / non-secure context) →
* falls back to the legacy document.execCommand('copy') path using a
* hidden