summaryrefslogtreecommitdiff
path: root/bubble.html
blob: c3fe36fbc4ca07c2682dfd571a8b21a3b8b40220 (plain)
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>D3 demo</title>
</head>
<style>
html, body {
    padding: 0;
    margin: 0;
}
#map {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}
#map svg {
    display: block;
    width: 100%;
    height: 100%;
}
/* style for info panel */
#infobox {
    border-radius: 10px;
    background-color: #f0f0f0;
    width: 240px;
    height: 340px;
    position: fixed;
    left: 6px;
    top: 6px;
    opacity: .5;
    z-index: 2; /* show above the map */
    display: flex;
    flex-direction: column;
}
#infobox:hover {
    opacity: 1;
}
#infobox .draggable {
    background-color: #cfcfcf;
    width: 100%;
    height: 20px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    cursor: move;
}
#infobox .content {
    flex: 1; /* fill remaining space */
    overflow: auto;
    margin: 6px 3px;
}
#infobox .status, #infobox .status li {
    margin: 0;
    padding: 0;
    /* hide too large text unless you hover over it */
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
#infobox .status li:hover {
    overflow: visible;
    white-space: normal;
}
#infobox:not(.user-locked) .not-auto {
    display: none;
}
#infobox .zoom-level:after {
    content: "%";
}
/* user info */
#infobox .user-info {
    /* initially there is no user to show info about */
    display: none;
}
#infobox .user-info .user-stats,
#infobox .user-info .user-stats li {
    padding: 0;
    margin: 0;
}
#infobox .user-info .name {
    margin: 0;
    padding: 0;
}
/* style for svg contents */
.node {
    stroke: #fff;
    stroke-width: 0.5px;
}
.node.spam {
    fill: orange;
}
.node.ham {
    fill: green;
}
.node.neighbor {
    fill: #fcc;
}
.node.selected {
    fill: #f00;
}
.link {
    stroke: #999;
    stroke-opacity: .6;
    /* fill none to prevent arcs lines being too thick */
    fill: none;
}
.arrow-head {
    fill-opacity: .6;
}
.link.neighbor {
    stroke: #f99;
}
</style>
<body>

<div id="infobox">
    <div class="draggable"></div>
    <div class="content">
        <ul class="status">
            <li>Total nodes: <span class="node-count"></span>
            <li>Total edges: <span class="edge-count"></span>
            <li>Zoom: <span class="zoom-level"></span> (scroll to zoom)
            <li>User info does <span class="not-auto">not</span> follow the
                mouse (double-click node to toggle)
        </ul>
        <div class="user-info">
            <h2 class="name"></h2>
            <ul class="user-stats">
            <li>User ID: <span class="userid"></span>
            <li>Tweets: <span class="tweet-count"></span>
            <li>Spam: <span class="spam-status"></span>
            <li>Relations (<span class="relations-from-count"></span> +
                    <span class="relations-to-count"></span>):
            </ul>
            <ul class="relations-from"></ul>
            <ul class="relations-to"></ul>
        </div>
    </div>
</div>

<div id="map"></div>

<script src="d3.js"></script>
<script src="collision.js"></script>
<script src="preprocess.js"></script>
<script src="bubble.js"></script>
</body>
</html>