-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
100 lines (89 loc) · 3.86 KB
/
index.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>My Awesome Game</title>
<link rel="stylesheet" href="reset.css">
<style>
body {
background-color: #eee;
overflow: none;
}
#flex-container {
position: absolute;
height: 960px;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
#output {
position: fixed;
width: 20%;
height: 100%;
left: 0;
top: 0;
}
</style>
</head>
<body>
<div id="spinner"></div>
<div id="status">Downloading...</div>
<progress hidden id="progress" max="100" value="0"></progress>
<div id="flex-container">
<div class="row">
<canvas id="canvas" oncontextmenu="event.preventDefault()" tabindex="-1"></canvas>
</div>
</div>
<script>
var statusElement = document.getElementById("status"),
progressElement = document.getElementById("progress"),
spinnerElement = document.getElementById("spinner"),
canvas = document.getElementById("canvas");
function focusCanvas() { canvas.focus(); }
canvas.addEventListener("click", focusCanvas);
var Module = {
preRun: [focusCanvas],
postRun: [],
print: function () {
var e = document.getElementById("output");
return e && (e.value = ""),
function (t) {
arguments.length > 1 && (t = Array.prototype.slice.call(arguments).join(" ")), console.log(t), e && (e.value += t + "\n", e.scrollTop = e.scrollHeight)
}
}(),
printErr: function (e) {
arguments.length > 1 && (e = Array.prototype.slice.call(arguments).join(" ")), console.error(e)
},
canvas: function () {
var e = document.getElementById("canvas");
return e.addEventListener("webglcontextlost", (function (e) {
alert("WebGL context lost. You will need to reload the page."), e.preventDefault()
}), !1), e
}(),
setStatus: function (e) {
if (Module.setStatus.last || (Module.setStatus.last = {
time: Date.now(),
text: ""
}), e !== Module.setStatus.last.text) {
var t = e.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/),
n = Date.now();
t && n - Module.setStatus.last.time < 30 || (Module.setStatus.last.time = n, Module.setStatus.last.text = e, t ? (e = t[1], progressElement.value = 100 * parseInt(t[2]), progressElement.max = 100 * parseInt(t[4]), progressElement.hidden = !1, spinnerElement.hidden = !1) : (progressElement.value = null, progressElement.max = null, progressElement.hidden = !0, e || (spinnerElement.style.display = "none")), statusElement.innerHTML = e)
}
},
totalDependencies: 0,
monitorRunDependencies: function (e) {
this.totalDependencies = Math.max(this.totalDependencies, e), Module.setStatus(e ? "Preparing... (" + (this.totalDependencies - e) + "/" + this.totalDependencies + ")" : "All downloads complete.")
}
};
Module.setStatus("Downloading..."), window.onerror = function (e) {
Module.setStatus("Exception thrown, see JavaScript console"), spinnerElement.style.display = "none", Module.setStatus = function (e) {
e && Module.printErr("[post-exception status] " + e)
}
}
</script>
<script async src="QuasarRush.js"></script>
</body>
</html>