forked from hossainalhaidari/pastr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
34 lines (33 loc) · 1.01 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Pastr</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/sakura.css@1.4.1/css/sakura-dark.min.css"
/>
</head>
<body>
<textarea rows="5" id="input"></textarea>
<button onclick="shorten()">Shorten</button>
<div id="result" style="display: none">
<blockquote id="url"></blockquote>
<button onClick="copy()">Copy</button>
</div>
<script type="text/javascript">
function copy() {
navigator.clipboard.writeText(document.getElementById("url").innerHTML);
}
async function shorten() {
const response = await fetch("/", {
method: "POST",
body: document.getElementById("input").value,
});
document.getElementById("url").innerHTML = await response.text();
document.getElementById("result").style = "";
}
</script>
</body>
</html>