Files
twtxt-lib/public/demo/theme-toggle.js
Eric Woodward 1c06197be0 resolve issue with missing vite-plugin-node-polyfills
add LibreJS licenses to all demo JS
split browser build from node build
add copyright info to license files
update to use yarn v4.13.0
update to v0.9.2
2026-03-07 20:47:14 -05:00

34 lines
951 B
JavaScript

// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
document.addEventListener("DOMContentLoaded", () => {
const toggle = document.createElement("button");
toggle.classList.add("themeToggle-button");
toggle.setAttribute("id", "themeToggle-button");
toggle.addEventListener("click", () => {
document.body.classList.toggle("invertedTheme");
});
toggle.innerHTML = `
<svg
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
width="1em"
height="1em"
class="themeToggle-svgIndicator"
fill="currentColor"
viewBox="0 0 32 32"
>
<path
d="M16 .5C7.4.5.5 7.4.5 16S7.4 31.5 16 31.5 31.5 24.6 31.5 16 24.6.5
16 .5zm0 28.1V3.4C23 3.4 28.6 9 28.6 16S23 28.6 16 28.6z"
/>
</svg>
`.trim();
document.body.appendChild(toggle);
});
// @license-end