-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
106 lines (100 loc) · 2.81 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
101
102
103
104
105
106
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
<title>Fractal</title>
<style type="text/css">
html, body {
margin: 0;
padding: 0;
background-color: black;
}
canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
#no-support, #instructions {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
margin: 1em;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
#no-support-inner, #instructions-inner {
background-color: white;
max-width: 25em;
padding: 0.5em 1em;
font-family: monospace;
color: rgb(120, 116, 118);
line-height: 1.4em;
border-bottom: 4px solid #454545;
border-left: 2px solid grey;
border-right: 2px solid grey
}
key\: {
display: inline-block;
line-height: 1.3em;
text-align: center;
background-color: #e0e0e0;
height: 1.3em;
width: 1.3em;
border-radius: 2px;
border-left: 1px solid #b3b3b3;
border-right: 1px solid #b3b3b3;
border-top: 1px solid #d4d4d4;
border-bottom: 1px solid #5a5a5a;
color: black;
margin: 2px 0px;
}
</style>
</head>
<body>
<canvas id="fractal-canvas-small"></canvas>
<canvas id="fractal-canvas-medium"></canvas>
<canvas id="fractal-canvas-large"></canvas>
<canvas id="fractal-canvas-retina"></canvas>
<div id="no-support" style="display:none">
<div id="no-support-inner"></div>
</div>
<div id="instructions" style="display:none">
<div id="instructions-inner">
Pan using the <key:>W</key:>, <key:>A</key:>, <key:>S</key:> and <key:>D</key:> keys. Zoom using the <key:>+</key:> and <key:>-</key:> keys. Hit any key to close this.
</div>
</div>
<script type="text/javascript">
function displayNoSupport(text) {
document.getElementById("no-support-inner").textContent = text;
document.getElementById("no-support").style.display = "flex";
}
function displayInstructions() {
document.getElementById("instructions").style.display = "flex";
}
var instructionsAreHidden = false;
function hideInstructions() {
if(instructionsAreHidden) return;
document.getElementById("instructions").style.display = "none";
instructionsAreHidden = true;
}
const isWasmSupported = (() => {
try {
if (typeof WebAssembly === "object"
&& typeof WebAssembly.instantiate === "function") {
const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));
if (module instanceof WebAssembly.Module)
return new WebAssembly.Instance(module) instanceof WebAssembly.Instance;
}
} catch (e) {
}
return false;
})();
if(!isWasmSupported) displayNoSupport("I'm sorry, but your browser does not appear to support WebAssembly, which is required for this program to run.");
</script>
<script src='./js/index.js'></script>
</body>
</html>