-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
255 lines (219 loc) · 11.7 KB
/
index.html
File metadata and controls
255 lines (219 loc) · 11.7 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<title>Tweet2Doom: State Tree Explorer</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Tweet2Doom" />
<meta name="twitter:description" content="State explorer of the @tweet2doom tree" />
<meta name="twitter:image" content="https://tweet2doom.github.io/images/cover.png" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<link rel="apple-touch-icon" sizes="57x57" href="/icons/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/icons/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/icons/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/icons/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/icons/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/icons/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/icons/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/icons/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/icons/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/icons/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png">
<link rel="manifest" href="/icons/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/icons/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" href="style.css">
<script type="text/javascript" src="js/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="js/hammer.min.js"></script>
<script type="text/javascript" src="js/gghelpers.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-02L2C8V1GQ"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-02L2C8V1GQ');
</script>
</head>
<body>
<div id="main-container">
<div id="description" align="center">
<h2>Tweet2Doom - State Tree Explorer</h2>
<div id="container_status" align="center">
Loading WebAssembly module - please wait ...
</div>
</div>
<div id="container_canvas" hidden>
<canvas class="emscripten" id="canvas"></canvas>
</div>
</div>
<div id="footer" class="cell-version" hidden>
<span hidden>
Build time: <span class="nav-link">Sat Oct 30 12:35:02 2021</span> |
Commit hash: <a class="nav-link" href="https://github.com/ggerganov/tweet2doom-data/commit/9256456f">9256456f</a> |
Commit subject: <span class="nav-link">UI improvements + achievements</span> |
</span>
</div>
<!--
<div class="cell-about" hidden>
<a class="nav-link" href="https://github.com/ggerganov/tweet2doom-data"><span class="d-none d-sm-inline">View on GitHub </span>
<svg version="1.1" width="16" height="16" viewBox="0 0 16 16" class="octicon octicon-mark-github" aria-hidden="true"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg>
</a>
</div>
-->
<script type='text/javascript'>
var isInitialized = false;
var failedToInitialize = false;
function updateWindowSize() {
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
//Module._set_window_size(0.99*x, y - 1.40*document.getElementById('footer').clientHeight);
Module._set_window_size(0.99*x, 0.99*y);
}
window.setInterval(function(){
if (mobileCheck()) {
document.getElementById("footer").innerHTML = '';
}
if (isInitialized == false) return;
updateWindowSize();
}, 500);
function onkeydown(event) {
if (event.ctrlKey ||
(event.keyCode >= 112 && event.keyCode <= 123)) {
event.stopImmediatePropagation();
return;
}
if (event.keyCode == 8 || // Backspace
event.keyCode == 9 || // Tab
event.keyCode == 46 || // Delete
(event.keyCode >= 37 && event.keyCode <= 40)) { // Arrow keys
event.preventDefault();
}
}
function checkForActions(event) {
setTimeout(function() {
var openUrl = Module.get_action_open_url();
if (openUrl.length > 2) {
window.open(openUrl, '_blank').focus();
}
}, 250);
}
function init() {
document.getElementById('container_status').innerHTML = "WebAssembly module initialized successfully!"
document.getElementById('container_status').style.color = "#00ff00";
window.addEventListener('keydown', onkeydown, true);
window.addEventListener('touchend', checkForActions, true);
window.addEventListener('mouseup', checkForActions, true);
}
function doInit() {
if (isInitialized == false) {
$.ajaxSetup({ async: false });
$.getJSON("json/nodes.json", function(json) {
for (var idx in json) {
var node = json[idx];
var type = node.group == 'root' ? 0 : node.group == 'node' ? 1 : 2;
Module.add_node(node.id, node.label, node.level, type, 0, 0);
}
});
$.getJSON("json/positions.json", function(json) {
for (var id in json) {
var node = json[id];
Module.update_node_position(id, node.x, node.y);
}
});
$.getJSON("json/edges.json", function(json) {
for (var idx in json) {
var edge = json[idx];
Module.add_edge(edge.from, edge.to);
}
});
$.ajaxSetup({ async: true });
var focusId = findGetParameter('f') || '';
Module.focus_node(focusId);
Module._tree_changed();
Module._do_init();
updateWindowSize();
isInitialized = true;
}
{
var status = document.getElementById("description");
status.hidden = true;
}
{
var canvas = document.getElementById("container_canvas");
canvas.hidden = false;
canvas.classList.add("fade-in");
// does not work well with touch pads
if (mobileCheck()) {
var hammertime = new Hammer(canvas, {});
hammertime.get('pinch').set({ enable: true });
hammertime.on('pinchstart pinch pinchend', function(ev) {
//window.alert(ev.scale);
//window.alert(JSON.stringify(ev));
if (ev.type == 'pinchstart') {
Module._set_pinch(ev.center.x, ev.center.y, ev.scale, 0);
}
if (ev.type == 'pinch') {
Module._set_pinch(ev.center.x, ev.center.y, ev.scale, 1);
}
if (ev.type == 'pinchend') {
Module._set_pinch(ev.center.x, ev.center.y, ev.scale, 2);
}
});
}
}
}
var Module = {
arguments: [],
preRun: [(function() { }) ],
postRun: [(function () {
if (failedToInitialize) return;
init();
doInit();
})
],
canvas: (function() {
var canvas = document.getElementById('canvas');
canvas.addEventListener("webglcontextlost", function(e) {
alert('WebGL context lost. You will need to reload the page.'); e.preventDefault();
}, false);
return canvas;
})(),
print: function(text) {
text = Array.prototype.slice.call(arguments).join(' ');
console.log(text);
},
printErr: function(text) {
text = Array.prototype.slice.call(arguments).join(' ');
console.error(text);
},
setStatus: function(text) {
console.log("status: " + text);
},
monitorRunDependencies: function(left) {
// no run dependencies to log
}
};
window.onerror = function(event) {
failedToInitialize = true;
console.log("onerror: " + JSON.stringify(event));
document.getElementById('container_status').innerHTML = JSON.stringify(event);
document.getElementById('container_status').innerHTML += '<br>This browser is not supported. Please try a different browser';
document.getElementById('container_status').style.color = "#ff0000";
};
</script>
<!--<script async type="text/javascript" src="t2d-explorer.js"></script>-->
<script>document.write('<script async type="text/javascript" src="t2d-explorer.js?dev=' + Math.floor(Math.random() * 1000) + '"\><\/script>');</script>
</body>
</html>