aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--views/archive/item.php9
-rw-r--r--views/archive/item_show.php5
2 files changed, 6 insertions, 8 deletions
diff --git a/views/archive/item.php b/views/archive/item.php
index 7ac34b1..3c9036e 100644
--- a/views/archive/item.php
+++ b/views/archive/item.php
@@ -18,14 +18,7 @@
<input type="hidden" name="url" value="<?= $page->URL ?>">
<button title="Export as PDF!"><?php include $VIEWS_DIR . '/img/pdf-export.svg' ?></button>
</form>
- <button id="copy-to-clipboard" title="Copy link to clipboard!"><?php include $VIEWS_DIR . '/img/link.svg' ?></button>
- <script type="text/javascript">
- const ctc = document.getElementById('copy-to-clipboard');
- ctc.onclick = function () {
- navigator.clipboard.writeText('<?= getenv("HTTP_HOST") . "/archives/" . $page->WID . "/index.php" ?>');
- alert("Copied link to clipboard!");
- };
- </script>
+ <button id="copy-to-clipboard" title="Copy link to clipboard!" onclick="copyLink('<?= getenv("HTTP_HOST") . "/archives/" . $page->WID . "/index.php" ?>')"><?php include $VIEWS_DIR . '/img/link.svg' ?></button>
</section>
<section name="itemButton" hidden>
<form action="/list/add" method="GET">
diff --git a/views/archive/item_show.php b/views/archive/item_show.php
index 1a31f4b..5c5024c 100644
--- a/views/archive/item_show.php
+++ b/views/archive/item_show.php
@@ -5,4 +5,9 @@
}
}
authenticated(showButtons);
+
+ function copyLink(url) {
+ navigator.clipboard.writeText(url);
+ alert("Copied link to clipboard!");
+ }
</script>