From a5b2adc1bf119d5ef941e3e227df444d482c027b Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 12 Oct 2023 17:22:32 +0200 Subject: simplify copying --- .gitignore | 1 + copyurl.js | 13 +++++++++++++ index.html | 26 ++++++++++++++++++++------ style.css | 12 ++++++++++++ 4 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 copyurl.js diff --git a/.gitignore b/.gitignore index 485dee6..62f73a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .idea +.*.sw? diff --git a/copyurl.js b/copyurl.js new file mode 100644 index 0000000..421ab2c --- /dev/null +++ b/copyurl.js @@ -0,0 +1,13 @@ +function copyURL() { + var copyText = document.getElementById("url"); + navigator.clipboard.writeText(copyText.href); + copyText.classList.add("highlight"); + window.setTimeout(() => copyText.classList.remove("highlight"), 1500); + document.getElementById('share-notice').style.display = "none"; + document.getElementById('shared-notice').style.display = "initial"; +} + +function resetURL() { + document.getElementById('share-notice').style.display = "initial"; + document.getElementById('shared-notice').style.display = "none"; +} diff --git a/index.html b/index.html index 292cd48..661cd48 100644 --- a/index.html +++ b/index.html @@ -12,6 +12,7 @@ +