55 lines
1.3 KiB
HTML
55 lines
1.3 KiB
HTML
|
<html>
|
||
|
<head>
|
||
|
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no'/>
|
||
|
<style type="text/css">
|
||
|
html, body {
|
||
|
margin: 0;
|
||
|
|
||
|
width: 100%;
|
||
|
height: 100%;
|
||
|
min-width: 100%;
|
||
|
min-height: 100%;
|
||
|
}
|
||
|
|
||
|
body {
|
||
|
display: flex;
|
||
|
flex-direction: column;
|
||
|
align-items: center;
|
||
|
justify-content: center;
|
||
|
}
|
||
|
#output {
|
||
|
margin: 0;
|
||
|
padding: 0;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<p id="output">
|
||
|
<canvas id="canvas"></canvas>
|
||
|
</p>
|
||
|
<script>
|
||
|
var siteURL = new URL(window.location.href);
|
||
|
var w = siteURL.searchParams.get("w") || "800";
|
||
|
var h = siteURL.searchParams.get("h") || "480";
|
||
|
var canvas = document.getElementById('canvas');
|
||
|
canvas.setAttribute("width", w);
|
||
|
canvas.setAttribute("height", h);
|
||
|
console.log("Requested " + w + "x" + h + " px");
|
||
|
var Module = {
|
||
|
print: function(text) {
|
||
|
console.log(text);
|
||
|
},
|
||
|
printErr: function(text) {
|
||
|
console.error(text);
|
||
|
},
|
||
|
canvas: (function() {
|
||
|
return canvas;
|
||
|
})(),
|
||
|
arguments: [ siteURL.searchParams.get("w") || "800", siteURL.searchParams.get("h") || "480", siteURL.searchParams.get("example") ?? "default" ]
|
||
|
};
|
||
|
window.addEventListener("click", () => window.focus());
|
||
|
</script>
|
||
|
{{{ SCRIPT }}}
|
||
|
</body>
|
||
|
</html>
|