-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
70 lines (62 loc) · 1.95 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
<!doctype html>
<html lang="en-US">
<head>
<title>Test Interactive Bridge</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
html,
body {
height: 100%;
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
}
livery-bridge-interactive {
height: 100%;
}
</style>
</head>
<body>
<script type="module">
import './index.ts';
const params = new URLSearchParams(window.location.search);
function createInteractive() {
const interactive = document.createElement('livery-bridge-interactive');
// Note: This page can be used from other origins by players for (unsecure) testing purposes
interactive.playerOrigin = '*';
interactive.onload = () => {
window.interactiveBridge = interactive.interactiveBridge;
};
return interactive;
}
if (!params.has('mock')) {
document.body.appendChild(createInteractive());
} else {
const mock = document.createElement('livery-bridge-mock');
document.body.appendChild(mock);
const mockIframe = params.get('mock') === 'iframe';
if (mockIframe) {
const iframe = document.createElement('iframe');
iframe.src = 'index.html';
iframe.frameBorder = 0;
mock.appendChild(iframe);
}
mock.onload = () => {
window.playerBridge = mock.playerBridge;
if (!mockIframe) {
const interactive = createInteractive();
interactive.playerBridge = mock.playerBridge;
interactive.region = params.get('region') ?? '';
interactive.tenantId = params.get('tenantid') ?? '';
mock.appendChild(interactive);
}
};
}
</script>
</body>
</html>