-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
100 lines (89 loc) · 3.7 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!doctype html>
<html>
<head>
<!-- <link rel="stylesheet" href="index.css"> -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Wikidata explorer.</title>
<link rel="stylesheet" type="text/css" href="styles.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
</head>
<body>
<script src="https://d3js.org/d3.v4.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="queryService.js"></script>
<script src="script.js"></script>
<script src="jquery.md5.js"></script>
<!-- <script src="typeahead.js/typeahead.bundle.js"></script> -->
<div class="container-fluid">
<div class="row">
<div class="col-md-8" id="chart">
<p id="sampleEntity"></p>
<!-- <p id="wikidata"></p> -->
<svg id="graph"></svg>
</div>
<div class="col-md-3" style="margin: 15px;">
<div class="row">
<div class="col-md-12">
<form>
<div class="form-row align-items-center">
<input class="typeahead form-control">
<div class="col-auto">
<button type="button" class="btn btn-primary" onclick="setr()">Set root</button>
</div>
</div>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<p id="label" class="font-weight-bold" style="margin-top: 1rem;"></p>
<img id="image" style="max-width:100%; max-height:100%;" style="padding:15px;">
<p id="description" style='font-family: "Times New Roman", Georgia, Serif; text-align: justify; margin-top: 1rem;'></p>
<a href="#" onclick="qs.back()">back</a>
</div>
</div>
</div>
<div class="col-md-1" style="margin: 15px;">
</div>
</div>
</div>
<script>
function setr()
{
let selectedDatum = document.getElementsByClassName('typeahead form-control')[0].value;
console.log(selectedDatum);
qs.setRoot("wd:" + selectedDatum.id);
}
// var wikidata = new Bloodhound({
// datumTokenizer: function(datum) {
// return Bloodhound.tokenizers.whitespace(datum.value);
// },
// queryTokenizer: Bloodhound.tokenizers.whitespace,
// remote: {
// dataType: 'jsonp',
// wildcard: '%QUERY',
// url: "https://www.wikidata.org/w/api.php?action=wbsearchentities&format=json&language=en&type=item&continue=0&search=%QUERY&callback=?",
// transform: function(response) {
// // Map the remote source JSON array to a JavaScript object array
// return $.map(response.search, function(entity) {
// return {
// value: entity.label + " (" + entity.description + ")",
// id: entity.id,
// desc: description,
// };
// });
// }
// }
// });
// Instantiate the Typeahead UI
// $('.typeahead').typeahead(null, {
// display: 'value',
// source: wikidata
// });
// var selectedDatum;
// $('.typeahead').on('typeahead:selected', function(event, datum) {
// selectedDatum = datum;
// });
</script>
</body>
</html>