-
Notifications
You must be signed in to change notification settings - Fork 3
/
shell.html
executable file
·52 lines (51 loc) · 1.32 KB
/
shell.html
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
<!doctype HTML>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OmniChip-8 + Emscripten</title>
<style>
body {
font-family: sans-serif;
overflow: hidden;
}
canvas {
display: block;
}
#status {
background-color: hsl(60,20%,90%);
text-align: center;
height: 0;
}
</style>
</head>
<body>
<div id="status">Downloading...</div>
<canvas id="canvas" width="64" height="32" oncontextmenu="event.preventDefault()"></canvas>
<textarea id="output" rows="8" cols="60"></textarea>
<script type='text/javascript'>
var Module = {
print: (function(text) {
var element = document.getElementById('output');
if (element) element.value = ''; // clear browser cache
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
console.log(text);
if (element) {
element.value += text + "\n";
element.scrollTop = element.scrollHeight; // focus on bottom
}
};
})(),
printErr: function(text) { console.error(text); },
setStatus: (function(text) {
var element = document.getElementById('status');
if (element) element.textContent = ''; // clear browser cache
return function(text) { element.textContent = text; };
})(),
canvas: document.getElementById('canvas'),
};
</script>
{{{ SCRIPT }}}
</body>
</html>