-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
59 lines (58 loc) · 1.99 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
<!DOCTYPE html>
<head><meta property="og:image" content="https://raw.githubusercontent.com/kaheetonaa/covid19vn/master/fbthumbnail.jpg" />
<meta property="twitter:image" content="https://raw.githubusercontent.com/kaheetonaa/covid19vn/master/fbthumbnail.jpg" />
</head>
<body>
<div class="wrapper">
<div id="title"></div>
<div id="facebookshare"></div>
<div id="source"></div>
<div id="inputdata"></div>
<div id="description"></div>
<div id="BN"></div>
<div id="visualization3"></div>
<div id="visualization2"></div>
<div id="process"></div>
</div>
</div>
<script type="module">
import {Runtime} from "https://unpkg.com/@observablehq/runtime@4/dist/runtime.js";
import notebook from "https://api.observablehq.com/@kuquanghuylcb/vietnamese-covid-19-data.js?v=3";
const renders = {
"title":"#title",
"facebookshare":"#facebookshare",
"source":"#source",
"inputdata":"#inputdata",
"description":"#description",
"viewof BN": "#BN",
"visualization3": "#visualization3",
"process": "#process",
"visualization2": "#visualization2"
};
function render(_node, value) {
if (!(value instanceof Element)) {
const el = document.createElement("span");
el.innerHTML = value;
value = el;
}
if (_node.firstChild !== value) {
if (_node.firstChild) {
while (_node.lastChild !== _node.firstChild) _node.removeChild(_node.lastChild);
_node.replaceChild(value, _node.firstChild);
} else {
_node.appendChild(value);
}
}
}
const runtime = new Runtime();
const main = runtime.module(notebook, name => {
const selector = renders[name];
if (selector) {
return {fulfilled: (value) => render(document.querySelector(selector), value)}
} else {
return true;
}
});
</script>
</body>
</html>