diff options
| author | ilotterytea <iltsu@alright.party> | 2025-06-21 00:42:15 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-06-21 00:42:15 +0500 |
| commit | 3597760fa5c214cee4cd6196af4b22a805f80011 (patch) | |
| tree | a0d26b211dc5a5c022416bf138b1d148852aacb1 /public | |
| parent | fd6f5c28af20cb6c08a2c062e330d1af54e36c87 (diff) | |
feat: Copy URL button
Diffstat (limited to 'public')
| -rw-r--r-- | public/index.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/public/index.php b/public/index.php index d6ad180..05b6b81 100644 --- a/public/index.php +++ b/public/index.php @@ -427,14 +427,20 @@ $privacy_exists = is_file($_SERVER['DOCUMENT_ROOT'] . '/static/PRIVACY.txt'); </main> </body> +<?php if ($file): ?> + <script> + const fileTabButtons = document.getElementById('file-tab-buttons'); + fileTabButtons.innerHTML += `<button onclick="navigator.clipboard.writeText('${window.location.href}')">Copy URL</button>`; + </script> +<?php endif; ?> + <?php if ($file && !isset($_SESSION['is_moderator'])): ?> <script> // adding deletion button const files = JSON.parse(localStorage.getItem('uploaded_files') ?? '[]'); const file = files.find((x) => x.id === '<?= $file['id'] ?>'); if (file && file.urls && file.urls.deletion_url) { - const buttons = document.getElementById('file-tab-buttons'); - buttons.innerHTML = `<a href='${file.urls.deletion_url}'><button>Delete</button></a>` + buttons.innerHTML; + fileTabButtons.innerHTML = `<a href='${file.urls.deletion_url}'><button>Delete</button></a>` + fileTabButtons.innerHTML; } </script> <?php elseif (!$file): ?> |
