1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-17 22:24:49 +00:00
janet/web/index.html

142 lines
2.9 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>Dst</title>
<style type="text/css" media="screen">
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
#prompt {
white-space: nowrap;
width: calc(100% - 14px);
overflow: hidden;
font-family: monospace;
border: solid 2px black;
padding: 5px;
}
#prompt br {
display:none;
}
#prompt * {
display:inline;
white-space:nowrap;
}
#console {
border: solid 2px black;
width: calc(100% - 4px);
min-height: 200px;
font-family: monospace;
}
</style>
</head>
<body>
<pre id="console"></pre>
<div contenteditable="true" id="prompt"></div>
<script>
var con = document.getElementById('console');
var Module = {
preRun: function() {
var input = "";
var i = 0;
function stdin() {
if (input === "") {
input = prompt('Input:');
}
if (i < input.length) {
var code = input.charCodeAt(i);
++i;
return code;
} else {
return null;
}
}
function appendChunk(chunk) {
con.innerText += chunk + '\n';
}
var outbuf = "";
function stdout(asciiCode) {
if (asciiCode === 10) {
appendChunk(outbuf);
outbuf = '';
} else if (asciiCode === null) {
appendChunk(outbuf);
outbuf = ' ... ';
} else {
outbuf += String.fromCharCode(asciiCode);
}
}
var errbuf = "";
function stderr(asciiCode) {
if (asciiCode == 10) {
appendChunk(errbuf);
errbuf = '';
} else if (asciiCode === null) {
appendChunk(errbuf);
errbuf = ' ... ';
} else {
errbuf += String.fromCharCode(asciiCode);
}
}
FS.init(stdin, stdout, stderr);
}
};
</script>
<script src="dst.js"></script>
</body>
</html>