datatrash/template/view.html

35 lines
1.0 KiB
HTML
Raw Permalink Normal View History

2020-07-08 19:26:46 +00:00
<!DOCTYPE html>
<html>
<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 />
<a class="main button" href="?raw">Herunterladen</a>
<button id="copy" class="button" onclick="copyToClipboard()">
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) {
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>
2020-07-08 19:26:46 +00:00
</body>
</html>