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
+1 -19
View File
@@ -20,24 +20,6 @@
</div>
</div>
</div>
<script>
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();
});
</script>
<script src="js/index.js"></script>
</body>
</html>