datatrash/template/view.html

35 lines
1.1 KiB
HTML

<!DOCTYPE html>
<html lang="de-DE">
<head>
<title>datatrash</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="/static/index.css" rel="stylesheet" />
</head>
<body>
<main>
<h1><a href="/">datatrash</a></h1>
<textarea id="text" rows="20" cols="120" readonly>{text}</textarea>
<br />
<a class="main button" href="?raw">herunterladen</a>
<button id="copy" class="button" onclick="copyToClipboard()">
text kopieren
</button>
</main>
<script lang="javascript">
function copyToClipboard() {
const button = document.getElementById("copy");
if (!navigator.clipboard) {
button.innerText = "nicht unterstützt";
return;
}
const textarea = document.getElementById("text");
navigator.clipboard.writeText(textarea.value).then(
_ => { button.innerText = "kopiert!"; },
_ => { button.innerText = "nicht unterstützt"; },
);
}
</script>
</body>
</html>