-
Notifications
You must be signed in to change notification settings - Fork 36
/
index.html
114 lines (106 loc) · 3.47 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
101
102
103
104
105
106
107
108
109
110
111
112
113
<html>
<head>
<title>Lineage - Family tree visualization tool in D3</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap-responsive.min.css">
<script src="js/d3.v7.9.min.js"></script>
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/lineage.js"></script>
<script>
/* globals
Lineage
d3
*/
let lineage = null;
let menuStatus = false;
let config = null;
const urlParams = new URLSearchParams(window.location.search);
const startYear = parseInt(urlParams.get('startYear'), 10);
/* eslint-disable no-unused-vars */
function start() {
$.getJSON('config/config.json', (configuration) => {
config = configuration;
config.startYear = Number.isNaN(startYear) ? config.startYear : startYear;
lineage = new Lineage();
lineage(config);
lineage.loadJson(config.data);
if (config.menuDefaultOpen) toggleMenu();
});
}
/* eslint-enable no-unused-vars */
function toggleMenu() {
menuStatus = !menuStatus;
const menu = d3.select('#menu');
const left = menuStatus ? '0px' : '-341px';
menu.transition().duration(500).style('left', left);
}
</script>
</head>
<body onLoad="start()">
<div id="menu">
<button class="toggle__button" onClick="toggleMenu()">☰</button>
<div class="options">
<h1><a href="http://github.com/bengarvey/lineage">Lineage</a></h1>
<div class="checkbox">
<label class="options__label">
<input type="checkbox" class="checkbox-lg" id="musicOn">
Music
</label>
</div>
<div class="checkbox">
<label type="options__label">
<input type="checkbox" class="checkbox-lg" id="nightModeOn">
Night Mode
</label>
</div>
<div class="checkbox">
<label class="options__label">
<input type="checkbox" class="checkbox-lg" id="showDead"
onclick="lineage.setShowDead(this.checked);">
Show dead
</label>
</div>
</div>
<div class="views">
<button class="btn btn-default view__button"
onClick="lineage.setMode('tree');">
Tree
</button>
<button class="btn btn-default view__button"
onClick="lineage.setMode('timeline');">
Timeline
</button>
<button class="btn btn-default view__button"
onClick="lineage.setMode('cluster');">
Cluster
</button>
</div>
<div class="time">
<button class="btn btn-default time__button" id="firstButton"
onClick="lineage.setYear(config.firstDate)">First</button>
<button class="btn btn-default time__button" id="playButton"
onClick="lineage.setPause(false);lineage.playMusic();">
Play
</button>
<button class="btn btn-default time__button" id="stopButton"
onClick="lineage.setPause(true);lineage.pauseMusic();">
Stop
</button>
<button class="btn btn-default time__button" id="lastButton"
onClick="lineage.setYear(config.lastDate)">
Last
</button>
</div>
<input id="search" class="form-control input-lg"
value=""
placeholder="Filter, e.g.: 'Kenobi Skywalker'">
</div>
<div id="year"></div>
<canvas height="1000" width="1000"></canvas>
<div id="memberDetails">
<div id="name"></div>
</div>
</body>
</html>