Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 52 lines (44 sloc) 1.456 kB
762dd35 @mjschranz old index.html was nuked. adding in my tesing code on separate page.
mjschranz authored
1 <html>
2 <head>
3 <title>Hack TO</title>
4 </head>
5 <script>
6 var w;
7
8 document.addEventListener("DOMContentLoaded", function(e){
9 w = new Worker("hackTO.js");
10
11 w.onmessage = function (e) {
12 var target = document.getElementById(e.data.id);
13 target.innerHTML = e.data.value;
14 };
15 }, false);
16
17 function randomNumber(){
18 var div = document.createElement("div");
19 div.id = "SuckJaw-" + Math.random() * 100000;
20 document.body.appendChild(div);
21
22 w.postMessage({ "cmd" : "randNum", "id" : div.id });
23 }
24
25 function sendText( data ){
26 var div = document.createElement("div");
27 div.id = "SuckJaw-" + Math.random() * 100000;
28 document.body.appendChild(div);
29 w.postMessage({ "cmd" : "sendText", "value" : document.getElementById("textData").value, "id" : div.id })
30 }
31
32 function counter(){
33 var div = document.createElement("div");
34 div.id = "SuckJaw-" + Math.random() * 100000;
35 document.body.appendChild(div);
36
37 w.postMessage({ "cmd" : "newCounter", "id" : div.id });
38 }
39
40 function stopWorker(){
41 w.terminate();
42 }
43 </script>
44 <body>
45 <button onclick="randomNumber()">Random Number!</button>
46 <button onclick="sendText()">Send text below!</button>
47 <button onclick="counter()">New Counter!</button>
48 <button onclick="stopWorker()">Stop!</button>
49 <br>
50 <input type="text" id="textData" />
51 </body>
52 </html>
Something went wrong with that request. Please try again.