|
|
|
@ -40,30 +40,6 @@ |
|
|
|
|
bottom: 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#output { |
|
|
|
|
position: fixed; |
|
|
|
|
display: none; |
|
|
|
|
font-family: 'Courier New', Courier, monospace; |
|
|
|
|
width: 100%; |
|
|
|
|
height: 15vh; |
|
|
|
|
top:85vh; |
|
|
|
|
bottom: 0; |
|
|
|
|
margin-left: 1rem; |
|
|
|
|
padding-left: 1rem; |
|
|
|
|
background: #000; |
|
|
|
|
color: #fff; |
|
|
|
|
outline: none; |
|
|
|
|
border: none; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#container.show-console { |
|
|
|
|
bottom: 15vh; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#output.show-console { |
|
|
|
|
display: block; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#canvas { |
|
|
|
|
display: block; |
|
|
|
|
border: 0px none; |
|
|
|
@ -75,12 +51,6 @@ |
|
|
|
|
outline: none; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#toggle-console { |
|
|
|
|
display: none; |
|
|
|
|
position: fixed; |
|
|
|
|
top: 1rem; |
|
|
|
|
left: 1rem; |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|
</head> |
|
|
|
|
|
|
|
|
@ -88,16 +58,12 @@ |
|
|
|
|
<div id="container"> |
|
|
|
|
<canvas id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas> |
|
|
|
|
</div> |
|
|
|
|
<button id="toggle-console">Toggle Console</button> |
|
|
|
|
<script type='text/javascript'> |
|
|
|
|
var Module = { |
|
|
|
|
print: (function () { |
|
|
|
|
return (...args) => { |
|
|
|
|
var text = args.join(' '); |
|
|
|
|
window.parent.postMessage({ |
|
|
|
|
message: "console-output", |
|
|
|
|
data: text + "\n", |
|
|
|
|
}, "*"); |
|
|
|
|
console.log(text); |
|
|
|
|
}; |
|
|
|
|
})(), |
|
|
|
|
canvas: (() => { |
|
|
|
@ -116,31 +82,6 @@ |
|
|
|
|
monitorRunDependencies: (left) => { |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
window.onerror = (event) => |
|
|
|
|
{ |
|
|
|
|
window.parent.postMessage({ |
|
|
|
|
message: "player-runtime-error", |
|
|
|
|
}, "*"); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
window.parent.postMessage({ |
|
|
|
|
message: "player-ready", |
|
|
|
|
}, "*"); |
|
|
|
|
|
|
|
|
|
window.addEventListener("message", (event) => |
|
|
|
|
{ |
|
|
|
|
if (typeof event.data !== "object") |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
if (typeof event.data.message !== "string") |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
if (event.data.message === "set-theme") { |
|
|
|
|
document.querySelector("body").className = event.data.theme; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
</script> |
|
|
|
|
{{{ SCRIPT }}} |
|
|
|
|
</body> |
|
|
|
|