From 1228f1df1725075514ea68943c2e87c2a05029b6 Mon Sep 17 00:00:00 2001 From: Tolmachev Igor Date: Sun, 1 Feb 2026 23:14:59 +0300 Subject: Add site --- script.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 script.js (limited to 'script.js') diff --git a/script.js b/script.js new file mode 100644 index 0000000..9afcb2c --- /dev/null +++ b/script.js @@ -0,0 +1,19 @@ +window.onload = () => { + document.querySelectorAll(".copy").forEach((element) => { + const tooltip = document.createElement("span"); + tooltip.textContent = " [copy]"; + tooltip.style.fontSize = "0.8em"; + tooltip.style.opacity = "0.7"; + element.appendChild(tooltip); + + element.addEventListener("click", () => { + try { + navigator.clipboard.writeText(element.attributes["copy-text"]?.value); + tooltip.textContent = " [copied]"; + } catch (error) { + tooltip.textContent = " [error]"; + } + setTimeout(() => (tooltip.textContent = " [copy]"), 1000); + }); + }); +}; -- cgit v1.2.3