-
Notifications
You must be signed in to change notification settings - Fork 16
/
index.html
executable file
·119 lines (106 loc) · 4.6 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
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Trizbort.io</title>
<link href="icon.png" rel="icon">
<link rel="stylesheet" href="dist/fonts/fonts.css">
<link rel="stylesheet" href="style.css">
<link rel="manifest" href="manifest.webmanifest">
</head>
<body>
<p style="font-family: 'danielbd';">Trizbort.io</p>
<header id="app-header">
<svg id="menu" class="icon" style="cursor: pointer; fill:#fff"><use xlink:href="dist/icons.svg#bars"></use></svg>
<h1 id="title"></h1>
<p class="subtitle" style="margin-left: 10px;" id="content"></p>
</header>
<canvas id="hittest" style="display: none; width: 1px; height: 1px"></canvas>
<canvas id="export" style="display: none"></canvas>
<div id="window">
<div class="window-body">
<h1 class="title">(title)</h1>
<p class="content">(content)</p>
</div>
<div class="window-buttons">
<button class="btn ok">OK</button>
<button class="btn cancel">Cancel</button>
</div>
</div>
<div id="editor">
<div id="status">
<div id="control-center" title="Center map"><svg class="icon small"><use xlink:href="dist/icons.svg#center"></use></svg></div>
<div id="control-zoomin" title="Zoom in"><svg class="icon small"><use xlink:href="dist/icons.svg#zoom-in"></use></svg></div>
<div id="control-zoomout" title="Zoom out"><svg class="icon small"><use xlink:href="dist/icons.svg#zoom-out"></use></svg></div>
<input id="control-zoom" type="text" value="100%">
</div>
<!-- <canvas id="canvas" tabindex='1' ></canvas> -->
<canvas id="bg-canvas" style="position: absolute; left: 0; top: 0; z-index: 0;"></canvas>
<canvas id="main-canvas" style="position: absolute; left: 0; top: 0; z-index: 1;" tabindex='1'></canvas>
</div>
<div id="toolpanel" class="panel panel-left show" style="width:75px"></div>
<div id="menupanel" class="panel panel-left" style="padding-left: 0; padding-right: 0"></div>
<div id="renderpanel" class="panel panel-right"></div>
<div id="mappanel" class="panel panel-right"></div>
<div id="roompanel" class="panel panel-right"></div>
<div id="connectorpanel" class="panel panel-right"></div>
<div id="notepanel" class="panel panel-right"></div>
<div id="blockpanel" class="panel panel-right"></div>
<div id="roompopup" class="popup"></div>
<div id="notepopup" class="popup"></div>
<div id="blockpopup" class="popup"></div>
<div id="connectorpopup" class="popup"></div>
<div id="toast" class="toast"></div>
<script src="dist/handlebars.runtime.min.js"></script>
<script src="dist/FileSaver.min.js"></script>
<script src="dist/system.js"></script>
<script src="dist/handlebars.js"></script>
<script src="dist/app.min.js"></script>
<script>
System.import('App').then(function(m) {
m.App.initialize();
});
</script>
<script type="module">
navigator.serviceWorker.register('serviceworker.js').then(reg => {
// refresh when new SW activates (work around "Update on reload")
let refreshing = false;
navigator.serviceWorker.addEventListener('controllerchange', () => {
if (refreshing) return;
refreshing = true;
window.location.reload();
});
// wait for reg.waiting or for reg.installing to covert to reg.waiting
function listenForWaitingServiceWorker(reg, callback) {
function awaitStateChange(sw) {
sw.addEventListener('statechange', () => {
if (sw.state === 'installed') callback(reg);
});
}
if (!reg) return;
if (reg.waiting) return callback(reg);
if (reg.installing) awaitStateChange(reg.installing);
reg.addEventListener('updatefound', () => awaitStateChange(reg.installing));
}
function promptUserToRefresh() {
let toast = document.getElementById("toast");
if (!toast) {
setTimeout(promptUserToRefresh, 5000);
return;
}
toast.style.display = 'block';
toast.querySelector('h3').innerHTML = "New version available";
let text = toast.querySelector('p')
text.innerHTML = "Please click here to refresh the page. <button>Refresh Now</button>";
text.querySelector("button").addEventListener('click', e => {
// skipWaiting will activate the waiting SW, which will refresh the page
reg.waiting.postMessage('skipWaiting');
})
}
listenForWaitingServiceWorker(reg, promptUserToRefresh);
});
</script>
</body>
</html>