Files
jfa-go/ts/crash.ts
Harvey Tindall 362984a391 web: remove almost every use of ml/mr
replace with flex and gap mostly. For #450.
2025-12-08 15:12:40 +00:00

45 lines
1.7 KiB
TypeScript

import { toClipboard } from "./modules/common.js";
const buttonNormal = document.getElementById("button-log-normal") as HTMLInputElement;
const buttonSanitized = document.getElementById("button-log-sanitized") as HTMLInputElement;
const logNormal = document.getElementById("log-normal") as HTMLInputElement;
const logSanitized = document.getElementById("log-sanitized") as HTMLInputElement;
const buttonChange = (type: string) => {
if (type == "normal") {
logSanitized.classList.add("unfocused");
logNormal.classList.remove("unfocused");
buttonNormal.classList.add("@high");
buttonNormal.classList.remove("@low");
buttonSanitized.classList.add("@low");
buttonSanitized.classList.remove("@high");
} else {
logNormal.classList.add("unfocused");
logSanitized.classList.remove("unfocused");
buttonSanitized.classList.add("@high");
buttonSanitized.classList.remove("@low");
buttonNormal.classList.add("@low");
buttonNormal.classList.remove("@high");
}
}
buttonNormal.onclick = () => buttonChange("normal");
buttonSanitized.onclick = () => buttonChange("sanitized");
const copyButton = document.getElementById("copy-log") as HTMLSpanElement;
copyButton.onclick = () => {
if (logSanitized.classList.contains("unfocused")) {
toClipboard("```\n" + logNormal.textContent + "```");
} else {
toClipboard("```\n" + logSanitized.textContent + "```");
}
copyButton.textContent = "Copied.";
copyButton.classList.add("~positive");
copyButton.classList.remove("~urge");
setTimeout(() => {
copyButton.textContent = "Copy";
copyButton.classList.add("~urge");
copyButton.classList.remove("~positive");
}, 1500);
};