-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
86 lines (64 loc) · 2.22 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
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<title>Limited Infection</title>
</head>
<style>
.node {
stroke: #fff;
stroke-width: 1.5px;
}
.link {
stroke: #999;
stroke-opacity: .6;
}
.node .infected {
fill: red;
}
.side {
position: fixed;
padding: 20px;
}
.mt {
margin-top: 10px;
}
</style>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<body>
<div class="side col-lg-offset-9 col-md-offset-9 col-sm-offset-9">
<h3>Click on any node to start an infection!</h3>
<h5>Maximize your browser for a better look.</h5>
<label>Generate new relation graph with this number of people: (150 if left blank)</label>
<input type="number" id="graphSize" class="form-control col col-lg-4" placeholder="150" min="0">
<button class="btn btn-default mt" onclick="start(document.getElementById('graphSize').value)">Generate</button>
<label>Start total infection from the node #: </label>
<input type="number" id="infectionStartPoint" class="form-control" placeholder="2, 5, 10.." min="0">
<button class="btn btn-default mt" onclick="infect(document.getElementById('infectionStartPoint').value)">Infect!</button>
<p>*nodes are numbered from 0 to (# of nodes - 1). If the given number is too large nothing will happen.</p>
<label>Start limited infection, set the infected cap: </label>
<input type="number" id="infectlim" class="form-control" placeholder="20, 50, 100..." min="0">
<button class="btn btn-default mt" onclick="liminfect(document.getElementById('infectlim').value)">Lim Infect!</button>
<p>*If the groups involved in lim infect were on different versions before, they will all have the same, newest version after this.</p>
<p>*If this number is too small, nothing will happen.</p>
</div>
<div>
</div>
</body>
<script src="js/d3.js"></script>
<script src="js/infection.js"></script>
<script>
var width = 960,
height = 700;
var color = d3.scale.category20();
var force = d3.layout.force()
.charge(-50)
.linkDistance(30)
.size([width, height]);
var svg = d3.select("body").append("svg")
.attr("class", "col-lg-9 col-md-9 col-sm-9")
.attr("height", height);
var graph, people;
var sizeMap, sizes;
// calls start() in infection.js, initializes the canvas
start(150);
</script>