/
snapshot_standalone.txt
65 lines (59 loc) · 1.57 KB
/
snapshot_standalone.txt
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>K3D snapshot viewer - [TIMESTAMP]</title>
<style>
body, html {
background-color: #F5F5F5;
margin: 0;
padding: 0;
overflow: hidden;
}
#canvasTarget {
width: 100%;
height: 100%;
position: absolute;
}
</style>
<script id='fflatejs'>[FFLATE_JS]</script>
<script>
window.k3dCompressed = '[K3D_SOURCE]';
function _base64ToArrayBuffer(base64) {
var binary_string = window.atob(base64);
var len = binary_string.length;
var bytes = new Uint8Array(len);
for (var i = 0; i < len; i++) {
bytes[i] = binary_string.charCodeAt(i);
}
return bytes;
}
var k3dSource = fflate.strFromU8(
fflate.unzlibSync(_base64ToArrayBuffer(window.k3dCompressed))
);
</script>
<script id='requirejs'>[REQUIRE_JS]</script>
</head>
<body>
<div id="canvasTarget"></div>
<script>
var K3DInstance;
var data = '[DATA]';
eval(k3dSource);
require(['k3d'], function (lib) {
try {
K3DInstance = new lib.CreateK3DAndLoadBinarySnapshot(
_base64ToArrayBuffer(data),
document.getElementById('canvasTarget'),
);
K3DInstance.then(function(K3DInstance) {
[ADDITIONAL]
});
} catch (e) {
console.log(e);
return;
}
});
</script>
</body>
</html>