This commit is contained in:
maurice committed 2026-11-14 18:25:54 +01:00
1 parent b444b5759d
commit a3067b011d
8 files changed
+123 -110

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
"use strict";
const copy = document.getElementById("copy-code");
const status = document.getElementById("copy-status");
const fallback = document.getElementById("raw-code");
copy.addEventListener("click", async () => {
const bytes = Uint8Array.from(atob(copy.dataset.raw), character => character.charCodeAt(0));
const content = new TextDecoder("utf-8", { ignoreBOM: true }).decode(bytes);
copy.disabled = true;
try {
await navigator.clipboard.writeText(content);
fallback.hidden = true;
} catch {
fallback.value = content;
fallback.hidden = false;
fallback.focus();
fallback.select();
} finally {
copy.disabled = false;
}
});