add code blocks + copy

This commit is contained in:
2025-05-24 05:12:46 +03:00
parent 66318698e5
commit 69bfaa8db0
5 changed files with 90 additions and 3 deletions

7
js/copy-code.js Normal file
View File

@ -0,0 +1,7 @@
for (let button of document.querySelectorAll(".copy-code")) {
button.addEventListener("click", async () => {
await navigator.clipboard.writeText(button.value)
button.textContent = "Copied!"
setTimeout(() => {button.textContent = "Copy"}, 1000.0)
})
}