add 'copy link' button to upload view
This commit is contained in:
parent
f5a7ed4213
commit
dc99b87bcc
|
@ -11,10 +11,27 @@
|
||||||
<h1><a href="/">datatrash</a></h1>
|
<h1><a href="/">datatrash</a></h1>
|
||||||
<p>
|
<p>
|
||||||
datei-link:
|
datei-link:
|
||||||
<a href="{url}">
|
<a id="link" href="{url}">
|
||||||
{url}
|
{url}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
<button id="copy" class="main button" onclick="copyToClipboard()">
|
||||||
|
link kopieren
|
||||||
|
</button>
|
||||||
</main>
|
</main>
|
||||||
|
<script lang="javascript">
|
||||||
|
function copyToClipboard() {
|
||||||
|
const button = document.getElementById("copy");
|
||||||
|
if (!navigator.clipboard) {
|
||||||
|
button.innerText = "nicht unterstützt";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const anchor = document.getElementById("link");
|
||||||
|
navigator.clipboard.writeText(anchor.href).then(
|
||||||
|
_ => { button.innerText = "kopiert!"; },
|
||||||
|
_ => { button.innerText = "nicht unterstützt"; },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue