-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
52 lines (52 loc) · 2.46 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
<!DOCTYPE html>
<html>
<head>
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<!-- JavaScript Bundle with Popper -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>
<script src="https://d3js.org/d3.v6.min.js"></script>
</head>
<body>
<section class="container mt-5 mb-5">
<h1>CDIAL Viewer</h1>
<div class="form-group">
<label for="id">CDIAL ID</label>
<select class="form-control" id="id"></select>
</div>
<table class="table table-bordered">
<thead>
<tr>
<th>Language</th>
<th>Lemma</th>
<th style="width: 50%;">Notes</th>
</tr>
</thead>
<tbody></tbody>
</table>
</section>
</body>
<script>
var dropdown = d3.select(".form-control")
d3.json("output2/index.json").then((list) => {
list.forEach(d => {
dropdown.append("option").text(d)
})
})
d3.json("output2/2814.json").then((data) => {
data.forEach(d => {
var tr = d3.select("tbody")
.append("tr")
tr.append("td").text(d.lang).attr("rowspan", d.words.length)
console.log(d.words)
for (var i = 0; i < d.words.length; i++) {
if (i == 0) tr.append("td").text(d.words[i])
else d3.select("tbody").append("tr").append("td").text(d.words[i])
}
tr.append("td").html(d.ref).attr("rowspan", d.words.length)
});
})
</script>
</html>