-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcatapult.html
68 lines (60 loc) · 2 KB
/
catapult.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
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<script src="../catapult/webcomponentsjs/webcomponents.js"></script>
<link rel="import" href="../catapult/polymer/polymer.html" />
<link type="text/css" rel="stylesheet" href="../catapult/main.css" />
<link type="text/css" rel="stylesheet" href="../catapult/status_view.css" />
<link type="text/css" rel="stylesheet" href="../catapult/events_view.css" />
<link
type="text/css"
rel="stylesheet"
href="../catapult/timeline_view.css"
/>
<link type="text/css" rel="stylesheet" href="../catapult/tab_views.css" />
<link
type="text/css"
rel="stylesheet"
href="../../node_modules/@blueprintjs/core/lib/css/blueprint.css"
/>
<link
type="text/css"
rel="stylesheet"
href="../catapult/sleuth-overrides.css"
/>
<link rel="import" href="../catapult/netlog_viewer.html" />
<script>
function load(payload) {
try {
console.log(`Attempting to load`, payload);
return LogUtil.loadLogFile(payload.content, payload.fileName);
} catch (error) {
console.log(`Tried to load, but failed. Deferring.`);
setTimeout(() => load(payload), 250);
}
}
// Since we're on a file:// protocol, we can't just
// call window.myMethod() from Sleuth and have to send
// it as a cross-origin message. This will help.
window.addEventListener('message', ({ data }) => {
if (!data) return;
const { instruction, payload } = data;
if (instruction === 'load') {
return load(payload);
}
if (instruction === 'dark-mode') {
console.log(`Setting dark mode to`, payload);
if (!!payload) {
document.body.classList.add('bp3-dark');
} else {
document.body.classList.remove('bp3-dark');
}
}
});
</script>
</head>
<body class="bp3-dark">
<netlog-viewer></netlog-viewer>
</body>
</html>