view 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
line wrap: on
line source

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Multipaint</title>
  <script src="processing.min.js"></script>
  <script src="mpui.js"></script>
</head>
<body>
<canvas id="mpCanvas"></canvas>
<div id="mpUI2"></div>
<script>
var mpMachine = 0;
var mpCanvas = document.getElementById("mpCanvas");
new Processing.loadSketchFromSources(mpCanvas, mpSources);

function mpWaitUntilSketchIsReady()
{
  var inst = Processing.getInstanceById("mpCanvas");
  if (inst)
  {
    var code = "var multipaintJS =\n"+ inst.externals.sketch.sourceCode;
    var uriContent = "data:application/octet-stream,"+ encodeURIComponent(code);
    document.getElementById("mpUI2").innerHTML = "<a href="+ uriContent +" download=\"multipaint.js\">Here is the download link</a>";
  }
  else
    setTimeout(mpWaitUntilSketchIsReady, 250);
}

document.addEventListener('DOMContentLoaded', mpWaitUntilSketchIsReady, false);

</script>
</body>
</html>