-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
52 lines (43 loc) · 1.02 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html>
<head>
<title>Spike</title>
</head>
<body>
<p>Hello world</p>
<script>
function allowDrop(holder) {
holder.ondragover = function () {
return false;
};
holder.ondragend = function () {
return false;
};
holder.ondrop = function (e) {
e.preventDefault();
var file = e.dataTransfer.files[0],
reader = new FileReader();
reader.onload = function (event) {
// put JS in the JavaScript panel
try {
// now kick off - basically just doing a copy and paste job from @wookiehangover - thanks man! :)
var worker = new Worker('worker.js');
// pass the worker the file object
worker.postMessage(file);
// bind onmessage handler
worker.onmessage = function (event) {
// send spike
};
} catch (e) {
// fail on the awesomeness...oh well
}
};
reader.readAsText(file);
return false;
};
}
// test for dnd and file api first
allowDrop(document.body);
</script>
</body>
</html>