This repository has been archived by the owner on Sep 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
49 lines (45 loc) · 1.56 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
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Minimal HTML head elements -->
<meta charset="utf-8" />
<title>Tissot's indicatrix</title>
</head>
<body>
<!-- Title of the page -->
<h1>Tissot's indicatrix</h1>
<!-- Empty placeholders -->
<div id="map"></div>
<p id="controls"></p>
<!-- JavaScript code to fill the empty placeholders with notebook cells
Note that the script is not vanilla JavaScript but an ES module
(type="module")
-->
<script type="module">
// Import Observable notebook
// To get the URL, go to the
// [notebook](https://observablehq.com/@fil/tissots-indicatrix), click on
// "…" and then on "Download code"
import notebook from 'https://api.observablehq.com/@fil/tissots-indicatrix.js?v=3';
// Import Observable library
import {
Runtime,
Inspector,
} from 'https://cdn.jsdelivr.net/npm/@observablehq/runtime@4/dist/runtime.js';
// Render selected notebook cells into DOM elements of this page
const runtime = new Runtime();
const main = runtime.module(notebook, name => {
switch (name) {
case 'display':
// render 'display' notebook cell into <div id="map"></div>
return new Inspector(document.querySelector('#map'));
break;
case 'viewof p':
// render 'viewof p' notebook cell into <p id="controls"></p>
return new Inspector(document.querySelector('#controls'));
break;
}
});
</script>
</body>
</html>