feat: transfer wowmine to neuro
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// @ts-check
|
||||
|
||||
const root = document.documentElement;
|
||||
const darkPreference = window.matchMedia("(prefers-color-scheme: dark)");
|
||||
|
||||
document.querySelectorAll("[data-theme-toggle]").forEach((button) => {
|
||||
button.addEventListener("click", () => {
|
||||
const dark = root.dataset.theme
|
||||
? root.dataset.theme === "dark"
|
||||
: darkPreference.matches;
|
||||
root.dataset.theme = dark ? "light" : "dark";
|
||||
button.setAttribute(
|
||||
"aria-label",
|
||||
dark ? "Включить тёмную тему" : "Включить светлую тему",
|
||||
);
|
||||
button.setAttribute("title", button.getAttribute("aria-label") ?? "");
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll("[data-copy-address]").forEach((button) => {
|
||||
button.addEventListener("click", async () => {
|
||||
const address = document.getElementById("server-address");
|
||||
const feedback = document.getElementById("copy-feedback");
|
||||
if (!address || !feedback) return;
|
||||
|
||||
try {
|
||||
await navigator.clipboard.writeText(address.innerText.trim());
|
||||
button.setAttribute("data-copied", "true");
|
||||
feedback.textContent = "Адрес скопирован. Увидимся в игре.";
|
||||
} catch (error) {
|
||||
if (!(error instanceof DOMException)) throw error;
|
||||
button.removeAttribute("data-copied");
|
||||
feedback.textContent = "Выдели адрес и скопируй его вручную.";
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user