say '<link rel="icon" type="image/png" href="/clip.png">';
say for map { @{$_} } $meta->{raw} || ();
say '<meta name="robots" content="noindex">' if $Dev;
- say "<script>$_</script>" for join($/,
- "docroot = document.documentElement;",
- "if (docroot.className == '') {",
- "new Map([",
- "['s-mono','(monochrome)'],",
- "['s-dark','(prefers-color-scheme: dark)'],",
- "['s-circus','(prefers-contrast: more)'],",
- "]).forEach((q,c) => {",
- "if (m = window.matchMedia(q))",
- "(m.onchange = e => docroot.classList.toggle(c, e.matches))(m)",
- "})",
- "}",
- );
+ say '<script src="/prefer.js"></script>';
say '</head>';
say '';
say sprintf '<body id="%s">', $file;
--- /dev/null
+(function prefstyle() {
+ docroot = document.documentElement;
+ if (docroot.className) {
+ return;
+ }
+ new Map([
+ ['s-mono', '(monochrome)'],
+ ['s-dark', '(prefers-color-scheme: dark)'],
+ ['s-circus', '(prefers-contrast: more)'],
+ ]).forEach((q,c) => {
+ if (m = window.matchMedia(q))
+ (m.onchange = e => docroot.classList.toggle(c, e.matches))(m);
+ });
+})();