James Kuszmaul | 36816f3 | 2019-08-31 16:58:23 -0700 | [diff] [blame] | 1 | <!doctype html> |
| 2 | <!--This file is adapted from https://github.com/emscripten-core/emscripten/blob/incoming/src/shell_minimal.html--> |
| 3 | <html lang="en-us"> |
| 4 | <head> |
| 5 | <meta charset="utf-8"> |
| 6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 7 | <title>Emscripten-Generated Code</title> |
| 8 | <style> |
| 9 | .emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; } |
| 10 | div.emscripten { text-align: center; } |
| 11 | /* the canvas *must not* have any border or padding, or mouse coords will be wrong */ |
| 12 | canvas.emscripten { |
| 13 | border: 0px none; |
| 14 | background-color: black; |
| 15 | } |
| 16 | |
| 17 | .spinner { |
| 18 | height: 50px; |
| 19 | width: 50px; |
| 20 | margin: 0px auto; |
| 21 | -webkit-animation: rotation .8s linear infinite; |
| 22 | -moz-animation: rotation .8s linear infinite; |
| 23 | -o-animation: rotation .8s linear infinite; |
| 24 | animation: rotation 0.8s linear infinite; |
| 25 | border-left: 10px solid rgb(0,150,240); |
| 26 | border-right: 10px solid rgb(0,150,240); |
| 27 | border-bottom: 10px solid rgb(0,150,240); |
| 28 | border-top: 10px solid rgb(100,0,200); |
| 29 | border-radius: 100%; |
| 30 | background-color: rgb(200,100,250); |
| 31 | } |
| 32 | @-webkit-keyframes rotation { |
| 33 | from {-webkit-transform: rotate(0deg);} |
| 34 | to {-webkit-transform: rotate(360deg);} |
| 35 | } |
| 36 | @-moz-keyframes rotation { |
| 37 | from {-moz-transform: rotate(0deg);} |
| 38 | to {-moz-transform: rotate(360deg);} |
| 39 | } |
| 40 | @-o-keyframes rotation { |
| 41 | from {-o-transform: rotate(0deg);} |
| 42 | to {-o-transform: rotate(360deg);} |
| 43 | } |
| 44 | @keyframes rotation { |
| 45 | from {transform: rotate(0deg);} |
| 46 | to {transform: rotate(360deg);} |
| 47 | } |
| 48 | |
| 49 | </style> |
| 50 | </head> |
| 51 | <body> |
| 52 | <figure style="overflow:visible;" id="spinner"><div class="spinner"></div><center style="margin-top:0.5em"><strong>emscripten</strong></center></figure> |
| 53 | <div class="emscripten" id="status">Downloading...</div> |
| 54 | <div class="emscripten"> |
| 55 | <progress value="0" max="100" id="progress" hidden=1></progress> |
| 56 | </div> |
| 57 | <!--The width and height values in the canvas specify the pixel width/height for the WebGL canvas. |
| 58 | The actual on-screen size is controlled by the stylesheet.--> |
James Kuszmaul | 6271cf7 | 2019-09-18 20:10:08 -0700 | [diff] [blame] | 59 | <canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" width=1200 height=600></canvas> |
| 60 | |
| 61 | <div> |
| 62 | General help information:<br> |
| 63 | <ul> |
| 64 | <li>Double-click to reset zoom.</li> |
| 65 | <li>Left-click to print mouse position (within plot) to console.</li> |
| 66 | <li>Ctrl-Z to undo zoom actions.</li> |
| 67 | <li>Right-click and drag to pan.</li> |
| 68 | <li>Left-click and drag zooms to the dragged area. If you press Escape while dragging, it will cancel the zoom.</li> |
| 69 | <li>Scroll up/down will zoom in and out.</li> |
| 70 | <li>Holding down "x" and "y" will restrict any |
| 71 | movement to the x and y axes respectively.</li> |
| 72 | </ul> |
| 73 | </div> |
James Kuszmaul | 36816f3 | 2019-08-31 16:58:23 -0700 | [diff] [blame] | 74 | |
| 75 | <script type='text/javascript'> |
| 76 | var statusElement = document.getElementById('status'); |
| 77 | var progressElement = document.getElementById('progress'); |
| 78 | var spinnerElement = document.getElementById('spinner'); |
| 79 | |
| 80 | var Module = { |
| 81 | preRun: [], |
| 82 | postRun: [], |
| 83 | print: (function() { |
| 84 | return function(text) { |
| 85 | if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' '); |
| 86 | console.log(text); |
| 87 | }; |
| 88 | })(), |
| 89 | printErr: function(text) { |
| 90 | if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' '); |
| 91 | console.error(text); |
| 92 | }, |
| 93 | canvas: (function() { |
| 94 | var canvas = document.getElementById('canvas'); |
| 95 | |
| 96 | // As a default initial behavior, pop up an alert when webgl context is lost. To make your |
| 97 | // application robust, you may want to override this behavior before shipping! |
| 98 | // See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2 |
| 99 | canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false); |
| 100 | |
| 101 | return canvas; |
| 102 | })(), |
| 103 | setStatus: function(text) { |
| 104 | if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' }; |
| 105 | if (text === Module.setStatus.last.text) return; |
| 106 | var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/); |
| 107 | var now = Date.now(); |
| 108 | if (m && now - Module.setStatus.last.time < 30) return; // if this is a progress update, skip it if too soon |
| 109 | Module.setStatus.last.time = now; |
| 110 | Module.setStatus.last.text = text; |
| 111 | if (m) { |
| 112 | text = m[1]; |
| 113 | progressElement.value = parseInt(m[2])*100; |
| 114 | progressElement.max = parseInt(m[4])*100; |
| 115 | progressElement.hidden = false; |
| 116 | spinnerElement.hidden = false; |
| 117 | } else { |
| 118 | progressElement.value = null; |
| 119 | progressElement.max = null; |
| 120 | progressElement.hidden = true; |
| 121 | if (!text) spinnerElement.hidden = true; |
| 122 | } |
| 123 | statusElement.innerHTML = text; |
| 124 | }, |
| 125 | totalDependencies: 0, |
| 126 | monitorRunDependencies: function(left) { |
| 127 | this.totalDependencies = Math.max(this.totalDependencies, left); |
| 128 | Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.'); |
| 129 | } |
| 130 | }; |
| 131 | Module.setStatus('Downloading...'); |
| 132 | window.onerror = function() { |
| 133 | Module.setStatus('Exception thrown, see JavaScript console'); |
| 134 | spinnerElement.style.display = 'none'; |
| 135 | Module.setStatus = function(text) { |
| 136 | if (text) Module.printErr('[post-exception status] ' + text); |
| 137 | }; |
| 138 | }; |
| 139 | </script> |
| 140 | {{{ SCRIPT }}} |
| 141 | </body> |
| 142 | </html> |