aboutsummaryrefslogtreecommitdiff
path: root/src/shell.html
blob: bf81c971636eeb0d5ff3d9644e03c53de34a6064 (plain)
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
53
54
<!doctype html>
<html lang="en-us">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Emscripten-Generated Code</title>
    <style>
      .emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
      canvas.emscripten { border: 1px solid black; }
      textarea.emscripten { font-family: monospace; width: 80%; }
      div.emscripten { text-align: center; }
    </style>
  </head>
  <body>
    <canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
    <ht/>
    <div class="emscripten"><input type="button" value="fullscreen" onclick="Module.requestFullScreen()"></div>
    <hr/>
    <textarea class="emscripten" id="output" rows="8"></textarea>
    <hr>
    <div class="emscripten" id="status">Downloading...</div>
    <hr>
    <script type='text/javascript'>
      // connect to canvas
      var Module = {
        print: (function() {
          var element = document.getElementById('output');
          element.value = ''; // clear browser cache
          return function(text) {
            // These replacements are necessary if you render to raw HTML
            //text = text.replace(/&/g, "&amp;");
            //text = text.replace(/</g, "&lt;");
            //text = text.replace(/>/g, "&gt;");
            //text = text.replace('\n', '<br>', 'g');
            element.value += text + "\n";
            element.scrollTop = 99999; // focus on bottom
          };
        })(),
        canvas: document.getElementById('canvas'),
        setStatus: function(text) {
          document.getElementById('status').innerHTML = text;
        },
        totalDependencies: 0,
        monitorRunDependencies: function(left) {
          this.totalDependencies = Math.max(this.totalDependencies, left);
          Module.setStatus(left ? 'Downloading: ' + (this.totalDependencies-left) + '/' + this.totalDependencies : 'All downloads complete.');
        }
      };

      {{{ SCRIPT_CODE }}}

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