document.addEventListener("DOMContentLoaded", () => { const d = document, m = Math, h = d.documentElement, c = d.cookie.split("; "), t = c.find(r => r.startsWith("theme=")), o = "path=/; samesite=strict; expires", q = "querySelectorAll", l = "classList"; h[l][(t && t.split("=")[1] == "invert")?"add":"remove"]("invert"); d.querySelector("#invert").addEventListener("click", () => d.cookie = h[l].toggle("invert")? `theme=invert; ${o}=Fri, 31 Dec 9999 23:59:59 GMT`: `theme=; ${o}=Thu, 01 Jan 1970 00:00:00 GMT`); // Add line numbers to code blocks [...d[q]("pre.hljs code")].forEach(e => e.innerHTML = e.innerHTML.split("\n").map((l,i,a) => l && `
${l}
`).join("\n")); // Disable Android Chrome "tap to search" when revealing spoiler text [...d[q]("mark")].forEach(e => e.tabIndex = "-1"); const ZLM_UNICODE_START = 0xED80; const LERFU_INDEX = "ptkflscmx.' 1234bdgvrzjn`-,~ aeiouy qw AEIOUY"; const lerfuLookup = c => String.fromCodePoint(ZLM_UNICODE_START + LERFU_INDEX.indexOf(c)); function latinToZlm(c) { if (c.codePointAt(0) == 0x2019) c = "'"; if (c.codePointAt(0) >= 0xED80) return c; if (" \n\t".includes(c)) return c; if (c == "h" || c == "H") c = "'"; if (LERFU_INDEX.indexOf(c) >= 0) return lerfuLookup(c); if (LERFU_INDEX.indexOf(c.toLowerCase()) >= 0) return lerfuLookup(c.toLowerCase()); return c; } [...d[q]("[lang=jbo]")].forEach(e => e.innerText = e.innerText.split("").map(latinToZlm).join("")); });