Mercurial > hg > forks > multipaint-js
annotate docompile.html @ 220:6db5defacbb3
Fix docompile.html.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 04 Sep 2018 15:44:13 +0300 |
parents | 13dda1c3ae88 |
children | a73a43454483 |
rev | line source |
---|---|
25
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 <!DOCTYPE html> |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
2 <html lang="en"> |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
3 <head> |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
4 <meta charset="UTF-8"> |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
5 <title>Multipaint</title> |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
6 <script src="processing.min.js"></script> |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
7 <script src="mpui.js"></script> |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
8 </head> |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
9 <body> |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
10 <canvas id="mpCanvas"></canvas> |
220 | 11 <div id="mpUI2"></div> |
25
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
12 <script> |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
13 var mpMachine = 0; |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
14 var mpCanvas = document.getElementById("mpCanvas"); |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
15 new Processing.loadSketchFromSources(mpCanvas, mpSources); |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
16 |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
17 function mpWaitUntilSketchIsReady() |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
18 { |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
19 var inst = Processing.getInstanceById("mpCanvas"); |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
20 if (inst) |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
21 { |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
22 var code = "var multipaintJS =\n"+ inst.externals.sketch.sourceCode; |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
23 var uriContent = "data:application/octet-stream,"+ encodeURIComponent(code); |
220 | 24 document.getElementById("mpUI2").innerHTML = "<a href="+ uriContent +" download=\"multipaint.js\">Here is the download link</a>"; |
25
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
25 } |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
26 else |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
27 setTimeout(mpWaitUntilSketchIsReady, 250); |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
28 } |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
29 |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
30 document.addEventListener('DOMContentLoaded', mpWaitUntilSketchIsReady, false); |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
31 |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
32 </script> |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
33 </body> |
13dda1c3ae88
As we launch from a browser now, include the HTML and necessary Javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
34 </html> |