-
Notifications
You must be signed in to change notification settings - Fork 1
/
post.html
46 lines (46 loc) · 1.53 KB
/
post.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
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html>
<head>
<title>paste</title>
<meta charset="utf-8">
<style>
/*body, html { margin: 0; padding: 0; height: 100%; }*/
#data { font-family: monospace; width: 100%; height: 85vh; top: 50px; right: 0; bottom: 0; left: 0; display: block; margin: 0; border: 1; resize: none; -moz-box-sizing: padding-box; -webkit-box-sizing: border-box; box-sizing: padding-box; padding: 8px; }
#submit { position: absolute; top: 1ex; right: 1ex; font-size: 1.2em; }
</style>
</head>
<body>
<p><code>
curl -T my_file.mp3 h45h.com
</code>
</p>
<form action="." method="post">
<textarea autofocus id="data" name="data"></textarea>
<button accesskey="s" id="submit" type="submit">pa<u>s</u>te</button>
</form>
<script>
document.getElementById("data").addEventListener("drop", function(event) {
try {
console.log(event);
event.preventDefault();
event.stopPropagation();
var dt = event.dataTransfer;
var files = dt.files;
var reader = new FileReader();
reader.addEventListener("loadend", function() {
document.getElementById("data").value = reader.result;
});
console.log(files);
console.log(reader);
reader.readAsText(files[0]);
} catch (e) {
console.log(e);
}
}, false);
document.getElementById("data").addEventListener("dragover", function(event) {
event.stopPropagation();
event.preventDefault();
}, false);
</script>
</body>
</html>