-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
137 lines (129 loc) · 3.87 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
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
133
134
135
136
137
<!DOCTYPE html>
<html>
<head>
<style>
body {
text-align:center;
}
.center {
margin-left: auto;
margin-right: auto;
}
.centered-text {
text-align: center;
}
.centered-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
}
.application-icon {
display: block;
margin-left: auto;
margin-right: auto;
max-width: 130px;
max-height: 130px;
width: auto;
height: auto;
}
.spinner {
max-width: 48px;
max-height: 48px;
}
</style>
<link rel="stylesheet" href="dark.css" media="(prefers-color-scheme: dark)" />
<link rel="stylesheet" href="light.css" media="(prefers-color-scheme: light)" />
<meta charset="utf-8">
<link rel="icon" type="image/png" href="icon.png">
<script>
function getChromeVersion() {
var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
return raw ? parseInt(raw[2], 10) : 0;
}
var wasmBuild = true;
if (window.chrome) {
if (getChromeVersion() < 106) {
wasmBuild = false;
}
}
</script>
<script>
function async_load(file, cb) {
var d = document, t = 'script',
o = d.createElement(t),
s = d.getElementsByTagName(t)[0];
o.src = file;
o.addEventListener('load', function (e) { cb(e); }, false);
s.parentNode.insertBefore(o, s);
}
function webgl_support () {
try {
var canvas = document.createElement('canvas');
return !!window.WebGLRenderingContext &&
(canvas.getContext('webgl') || canvas.getContext('experimental-webgl'));
} catch(e) {
return false;
}
}
function download_application() {
var action = document.getElementById("action");
var main = document.getElementById("main");
if (webgl_support()) {
if (wasmBuild && WebAssembly) {
action.innerHTML = "Downloading wasm_exec.js"
async_load("wasm_exec.js", function(){
// WebAssembly.instantiateStreaming is not currently available in Safari
if (WebAssembly && !WebAssembly.instantiateStreaming) { // polyfill
WebAssembly.instantiateStreaming = async (resp, importObject) => {
const source = await (await resp).arrayBuffer();
return await WebAssembly.instantiate(source, importObject);
};
}
action.innerHTML = "Downloading web assembly file.";
const go = new Go();
WebAssembly.instantiateStreaming(fetch("Fyne Demo.wasm"), go.importObject).then((result) => {
main.innerHTML = "";
go.run(result.instance);
});
})
} else {
action.innerHTML = "WebAssembly is not supported in your browser";
action.className = "action-error"
}
} else {
action.innerHTML = "WebGL is not supported in your browser";
action.className = "action-error"
}
}
</script>
</head>
<body scroll="no" style="overflow: hidden" onload="download_application()">
<div id="main">
<div class="centered-container">
<table class="center">
<tr><td><img class="application-icon" src="icon.png" alt="Application icon"/></td></tr>
<tr><td><div class="centered-text"><div class="application-name">Fyne Demo</div></div></td></tr>
<tr><td><div class="centered-text"><div class="application-version">v2.5.3</div></div></td></tr>
<tr>
<td>
<picture>
<source srcset="spinner_dark.gif" media="(prefers-color-scheme: dark)" />
<source srcset="spinner_light.gif" media="(prefers-color-scheme: light)" />
<img class="spinner" src="spinner_light.gif" />
</picture>
</td>
</tr>
<tr>
<td>
<div class="centered-text"><div class="action" id="action">
<noscript>Javascript need to be enable for this application to work.</noscript>
</div></div>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>