refactor: separate js code

This commit is contained in:
2026-06-25 05:58:51 +05:00
parent ddc8b93804
commit b3b0c645e9
13 changed files with 1182 additions and 1444 deletions
+17
View File
@@ -0,0 +1,17 @@
const input = document.getElementById("channel-input");
const copyBtn = document.getElementById("copy-btn");
const linkEl = document.getElementById("game-link");
function copyLink() {
const name = input.value.trim().toLowerCase() || "Ku6ep_XBOCTuK";
const url = `${location.origin}${location.pathname.replace(/\/[^/]*$/, "/")}game.html?channel=${encodeURIComponent(name)}`;
navigator.clipboard.writeText(url).then(() => {
linkEl.textContent = "СКОПИРОВАНО!";
linkEl.className = "copied";
});
}
copyBtn.addEventListener("click", copyLink);
input.addEventListener("keydown", (e) => {
if (e.key === "Enter") copyLink();
});