diff --git a/app/templates/base.html b/app/templates/base.html index eea9687..3fc98e8 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -24,7 +24,6 @@ - diff --git a/data/static/js/copy-code.js b/data/static/js/copy-code.js deleted file mode 100644 index ac9c7c7..0000000 --- a/data/static/js/copy-code.js +++ /dev/null @@ -1,7 +0,0 @@ -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) - }) -} diff --git a/data/static/js/ui.js b/data/static/js/ui.js index 38f52cb..03b2351 100644 --- a/data/static/js/ui.js +++ b/data/static/js/ui.js @@ -144,4 +144,13 @@ document.addEventListener("DOMContentLoaded", () => { openLightbox(belongingTo, idx); }); }); + + // copy code blocks + 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) + }) + }; });