-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
55 lines (43 loc) · 1.66 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
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<style>
html, body, main {
/* Ensure the body fills the view, so clicks are handled everywhere: */
width: 100%;
height: 100%;
}
</style>
<!-- Put SCRIPT tags to load 3rd party libraries here -->
</head>
<body>
<div id="main"></div><!-- This element is where the view will render -->
<script src="/_global_/customview/v1/omniscope.js"></script><!-- Add the Omniscope custom view API -->
<script>
if (!omniscope || !omniscope.view) throw new Error("Omniscope chart API is not loaded");
omniscope.view.on("load", function() {
window.onerror = function(msg) {
omniscope.view.error(msg);
}
});
// Ensure clicks on unoccupied space clear the selection in Omniscope, and close menus:
document.body.addEventListener("click", function() {
omniscope.view.whitespaceClick();
});
// Naively redraw on any of these events
// (load = first init, update = external settings/state change, resize = browser window resized)
omniscope.view.on(["load", "update", "resize"], function() {
// Retrieve the auto-query results, a 2d array ([row][column]):
var data = omniscope.view.context().result.data.records;
var content = "";
if (omniscope.view.context().options.items.dynamicHTML === true) {
content = data[0][0];
} else if (omniscope.view.context().options.items.aStaticHTML) {
content = omniscope.view.context().options.items.aStaticHTML;
}
document.getElementById("main").innerHTML = content;
});
</script>
</body>
</html>