Spaces:
Running
Running
Update index.html
Browse files- index.html +126 -18
index.html
CHANGED
@@ -1,19 +1,127 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
</html>
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en-us">
|
3 |
+
<head>
|
4 |
+
<meta charset="utf-8">
|
5 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
6 |
+
<title>Unity Web Player | MNIST Sample</title>
|
7 |
+
<link rel="shortcut icon" href="TemplateData/favicon.ico">
|
8 |
+
<link rel="stylesheet" href="TemplateData/style.css">
|
9 |
+
</head>
|
10 |
+
<body>
|
11 |
+
<div id="unity-container" class="unity-desktop">
|
12 |
+
<canvas id="unity-canvas" width=960 height=600 tabindex="-1"></canvas>
|
13 |
+
<div id="unity-loading-bar">
|
14 |
+
<div id="unity-logo"></div>
|
15 |
+
<div id="unity-progress-bar-empty">
|
16 |
+
<div id="unity-progress-bar-full"></div>
|
17 |
+
</div>
|
18 |
+
</div>
|
19 |
+
<div id="unity-warning"> </div>
|
20 |
+
<div id="unity-footer">
|
21 |
+
<div id="unity-logo-title-footer"></div>
|
22 |
+
<div id="unity-fullscreen-button"></div>
|
23 |
+
<div id="unity-build-title">MNIST Sample</div>
|
24 |
+
</div>
|
25 |
+
</div>
|
26 |
+
<script>
|
27 |
+
var canvas = document.querySelector("#unity-canvas");
|
28 |
+
|
29 |
+
// Shows a temporary message banner/ribbon for a few seconds, or
|
30 |
+
// a permanent error message on top of the canvas if type=='error'.
|
31 |
+
// If type=='warning', a yellow highlight color is used.
|
32 |
+
// Modify or remove this function to customize the visually presented
|
33 |
+
// way that non-critical warnings and error messages are presented to the
|
34 |
+
// user.
|
35 |
+
function unityShowBanner(msg, type) {
|
36 |
+
var warningBanner = document.querySelector("#unity-warning");
|
37 |
+
function updateBannerVisibility() {
|
38 |
+
warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
|
39 |
+
}
|
40 |
+
var div = document.createElement('div');
|
41 |
+
div.innerHTML = msg;
|
42 |
+
warningBanner.appendChild(div);
|
43 |
+
if (type == 'error') div.style = 'background: red; padding: 10px;';
|
44 |
+
else {
|
45 |
+
if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
|
46 |
+
setTimeout(function() {
|
47 |
+
warningBanner.removeChild(div);
|
48 |
+
updateBannerVisibility();
|
49 |
+
}, 5000);
|
50 |
+
}
|
51 |
+
updateBannerVisibility();
|
52 |
+
}
|
53 |
+
|
54 |
+
var buildUrl = "Build";
|
55 |
+
var loaderUrl = buildUrl + "/mnistwebsentis.loader.js";
|
56 |
+
var config = {
|
57 |
+
arguments: [],
|
58 |
+
dataUrl: buildUrl + "/mnistwebsentis.data",
|
59 |
+
frameworkUrl: buildUrl + "/mnistwebsentis.framework.js",
|
60 |
+
codeUrl: buildUrl + "/mnistwebsentis.wasm",
|
61 |
+
streamingAssetsUrl: "StreamingAssets",
|
62 |
+
companyName: "Unity",
|
63 |
+
productName: "MNIST Sample",
|
64 |
+
productVersion: "0.1",
|
65 |
+
showBanner: unityShowBanner,
|
66 |
+
};
|
67 |
+
|
68 |
+
// By default, Unity keeps WebGL canvas render target size matched with
|
69 |
+
// the DOM size of the canvas element (scaled by window.devicePixelRatio)
|
70 |
+
// Set this to false if you want to decouple this synchronization from
|
71 |
+
// happening inside the engine, and you would instead like to size up
|
72 |
+
// the canvas DOM size and WebGL render target sizes yourself.
|
73 |
+
// config.matchWebGLToCanvasSize = false;
|
74 |
+
|
75 |
+
// If you would like all file writes inside Unity Application.persistentDataPath
|
76 |
+
// directory to automatically persist so that the contents are remembered when
|
77 |
+
// the user revisits the site the next time, uncomment the following line:
|
78 |
+
// config.autoSyncPersistentDataPath = true;
|
79 |
+
// This autosyncing is currently not the default behavior to avoid regressing
|
80 |
+
// existing user projects that might rely on the earlier manual
|
81 |
+
// JS_FileSystem_Sync() behavior, but in future Unity version, this will be
|
82 |
+
// expected to change.
|
83 |
+
|
84 |
+
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
|
85 |
+
// Mobile device style: fill the whole browser client area with the game canvas:
|
86 |
+
|
87 |
+
var meta = document.createElement('meta');
|
88 |
+
meta.name = 'viewport';
|
89 |
+
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
|
90 |
+
document.getElementsByTagName('head')[0].appendChild(meta);
|
91 |
+
document.querySelector("#unity-container").className = "unity-mobile";
|
92 |
+
canvas.className = "unity-mobile";
|
93 |
+
|
94 |
+
// To lower canvas resolution on mobile devices to gain some
|
95 |
+
// performance, uncomment the following line:
|
96 |
+
// config.devicePixelRatio = 1;
|
97 |
+
|
98 |
+
|
99 |
+
} else {
|
100 |
+
// Desktop style: Render the game canvas in a window that can be maximized to fullscreen:
|
101 |
+
canvas.style.width = "960px";
|
102 |
+
canvas.style.height = "600px";
|
103 |
+
}
|
104 |
+
|
105 |
+
document.querySelector("#unity-loading-bar").style.display = "block";
|
106 |
+
|
107 |
+
var script = document.createElement("script");
|
108 |
+
script.src = loaderUrl;
|
109 |
+
script.onload = () => {
|
110 |
+
createUnityInstance(canvas, config, (progress) => {
|
111 |
+
document.querySelector("#unity-progress-bar-full").style.width = 100 * progress + "%";
|
112 |
+
}).then((unityInstance) => {
|
113 |
+
document.querySelector("#unity-loading-bar").style.display = "none";
|
114 |
+
document.querySelector("#unity-fullscreen-button").onclick = () => {
|
115 |
+
unityInstance.SetFullscreen(1);
|
116 |
+
};
|
117 |
+
|
118 |
+
}).catch((message) => {
|
119 |
+
alert(message);
|
120 |
+
});
|
121 |
+
};
|
122 |
+
|
123 |
+
document.body.appendChild(script);
|
124 |
+
|
125 |
+
</script>
|
126 |
+
</body>
|
127 |
</html>
|