-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathruntime.html
88 lines (76 loc) · 2.81 KB
/
runtime.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
<!doctype html>
<html lang="en" style="height: 100%;">
<head>
<meta charset="utf-8">
<link rel="manifest" href="./manifest.json">
<script src="./node_modules/blockly/blockly_compressed.js"></script>
<script src="./node_modules/blockly/blocks_compressed.js"></script>
<script src="./node_modules/blockly/javascript_compressed.js"></script>
<script src="./node_modules/dayjs/dayjs.min.js"></script>
<link rel="stylesheet" href="./assets/main.css">
<title>runtime</title>
<script src="./node_modules/construct-style-sheets-polyfill/dist/adoptedStyleSheets.js"></script>
<script>
let storedParentUrl;
window.esmsInitOptions = {
shimMode: true,
mapOverrides: true,
resolve: (id, parentUrl, resolve) => {
if (!storedParentUrl)
storedParentUrl = parentUrl;
if (parentUrl.startsWith('blob:'))
parentUrl = storedParentUrl;
return resolve(id, parentUrl)
}
}
</script>
<script src="./node_modules/es-module-shims/dist/es-module-shims.js"></script>
<script src="/webui.0.widgets/importmap.js"></script>
<script src="./dist/importmaps/importmap-runtime.js"></script>
<script src="config.js"></script>
</head>
<style>
body {
height: 100%;
margin: 0;
font-family: 'Roboto', 'Noto', sans-serif;
line-height: 1.5;
background-color: white;
-webkit-font-smoothing: antialiased;
}
</style>
<body>
<iobroker-webui-screen-viewer id="viewer"></iobroker-webui-screen-viewer>
<div id="overlayLayer"></div>
</body>
<script type="module">
const scp = document.createElement('script');
scp.src = iobrokerWebRootUrl + "webui.0.widgets/importmap.js";
document.head.appendChild(scp);
await importShim('./dist/frontend/runtime/init.js');
importShim('./dist/frontend/runtime/controls.js');
importShim(iobrokerWebRootUrl + 'webui.0.widgets/importWidgetFilesRuntime.js');
async function checkHash() {
const viewer = document.getElementById('viewer');
const par = new URLSearchParams(location.hash.substring(1));
let screen = (par).get('screenName');
if (screen) {
await customElements.whenDefined(viewer.localName);
} else {
screen = 'start';
}
await viewer.setScreenNameAndLoad(screen);
let subScreen = (par).get('subScreen');
if (subScreen) {
const targetSelector = (par).get('targetSelector') ?? 'iobroker-webui-screen-viewer';
const sv = viewer._getDomElements(targetSelector)[0];
sv.removeAttribute('screen-name');
sv.screenName = subScreen;
}
let imp = await importShim(iobrokerWebuiRootUrl + "dist/frontend/common/IobrokerHandler.js");
imp.iobrokerHandler.sendCommand("uiChangedView", screen);
}
checkHash();
window.onhashchange = checkHash;
</script>
</html>