add code blocks + copy
This commit is contained in:
7
js/copy-code.js
Normal file
7
js/copy-code.js
Normal 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)
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user