-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex1.html
132 lines (115 loc) · 3.5 KB
/
index1.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<style>
html,
body {
height: 100%;
width: 100%;
margin: 0px;
}
body {
font-family: Arial, Helvetica, sans-serif;
background: #111 url(bg_main.png);
}
.canvas {
display: block;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
}
.log {
color: #f67;
text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.5);
position: absolute;
left: 10px;
bottom: 30px;
font-weight: bold;
}
</style>
<title>ClassiCube</title>
<link rel="icon" href="bg_main.png">
</head>
<body>
<canvas width="1000" height="562" class="canvas"></canvas>
<span class="log"></span>
<script>
const canvas = document.querySelector(".canvas");
const log = document.querySelector(".log");
window.Module = {
preRun: [
() => {
addRunDependency("load-idb");
FS.mkdir("/classicube");
FS.mount(IDBFS, {}, "/classicube");
FS.syncfs(true, (err) => {
assert(!err);
removeRunDependency("load-idb");
});
},
],
locateFile(path, prefix) {
if (path === "/static/default.zip") {
return new URL("default.zip", location);
}
return prefix + path;
},
postRun: [],
arguments: ["steve"],
print: console.log,
printErr: console.error,
canvas: canvas,
postException: false,
setStatus(...text) {
if (this.postException) {
text.unshift("[post-exception status]");
}
log.textContent = text.join(" ");
},
totalDependencies: 0,
monitorRunDependencies(left) {
this.totalDependencies = Math.max(this.totalDependencies, left);
Module.setStatus(left ? "Preparing... (" + (this.totalDependencies - left) + "/" + this.totalDependencies + ")" : "All downloads complete.");
},
};
if (parent !== window) {
const dupe = (event) => window.dispatchEvent(new event.constructor(event.type, Object.fromEntries(Object.getOwnPropertyNames(event.constructor.prototype).map((x) => [x, event[x]]))));
parent.addEventListener("keydown", dupe);
parent.addEventListener("keyup", dupe);
}
document.addEventListener("click", () => {
window.focus();
canvas.focus();
});
function resize() {
const box = canvas.getBoundingClientRect();
canvas.width = box.right - box.left;
canvas.height = box.bottom - box.top;
}
resize();
window.addEventListener("resize", () => {
resize();
});
Module.setStatus("Downloading...");
window.addEventListener("error", (err) => {
Module.setStatus("Exception thrown, see JavaScript console");
Module.postException = true;
});
/*XMLHttpRequest.prototype.open = new Proxy(XMLHttpRequest.prototype.open, {
apply(target, that, [ method, url, async, username, password ]){
url = new URL(url, location);
if(url.origin != location.origin){
url = new URL('/service/gateway?url=' + encodeURIComponent(url), location);
}
return Reflect.apply(target, that, [ method, url, async, username, password ]);
},
});*/
</script>
<script src="ClassiCube.js"></script>
</body>
</html>