diff options
| author | Syndamia <kamen@syndamia.com> | 2025-02-09 21:29:08 +0200 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2025-02-09 21:29:08 +0200 |
| commit | 3807c4563441488e0ea7b1b2bff228983b3dba84 (patch) | |
| tree | c1910eedadd1eb830277902b114602385d364be7 /views | |
| parent | 9b06bc37badc54fdb043577143dcc33619c5b548 (diff) | |
| download | nowayforward_human-3807c4563441488e0ea7b1b2bff228983b3dba84.tar nowayforward_human-3807c4563441488e0ea7b1b2bff228983b3dba84.tar.gz nowayforward_human-3807c4563441488e0ea7b1b2bff228983b3dba84.zip | |
fix(views/archive): Item copy link not working properly
Diffstat (limited to 'views')
| -rw-r--r-- | views/archive/item.php | 9 | ||||
| -rw-r--r-- | views/archive/item_show.php | 5 |
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> |
