datatrash/template/view.html

35 lines
1.1 KiB
HTML
Raw Normal View History

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