forked from daostats/daostats.github.io
-
Notifications
You must be signed in to change notification settings - Fork 1
/
biggest - Copy.html
195 lines (142 loc) · 6.25 KB
/
biggest - Copy.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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<html>
<head>
<meta charset="utf-8">
<title>Accounts</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="datahelper.js" type="text/javascript"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
</head>
<body>
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">DAO Stats</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="index.html">Home</a></li>
<li><a href="nav.html">Search</a></li>
<li class="active"><a href="biggest.html">Accounts</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="about.html">About</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="container">
<!-- Example row of columns -->
<div class="row">
<div class="col-md-5">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Search Account address:</h3>
</div>
<div class="panel-body">
<div class="input-group">
<span class="input-group-addon" id="hexprefix">0x</span>
<input type="text" id="searchaccount" class="form-control" placeholder="0000000000000000000000000000000000000000" aria-describedby="Search account address">
<span class="input-group-addon alert-success collapsed" id="hexalert" data-toggle="tooltip" title="Invalid address">✔</span>
</div>
</div>
</div>
<h3>Total token volume: <span id="tknVol"></span></h3>
</div>
<div class="col-md-7">
<h4>Largest DAO token holders <small>Top 50</small></h4>
<div id="majInfo" class="well collapse">The top 50 holders collectively have <strong><span id="tokenpc"></span></strong> of all DAO tokens.<br />
<span id="top50maj" class="collapse">A token majority is held by the top <strong><span id="n-maj"></span></strong> accounts with <strong><span id="pc-maj"></span></strong> of the tokens.</span></div>
<div class="table-responsive">
<table id="amountTable" class="table">
<thead>
<tr>
<th>Account</th>
<th>Amount</th>
<th>Proportion</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div><!-- Container end -->
<script>
getData("biggest", function(data, status){
getData("vol", function(vdata, status){
vol = vdata[0];
amounts = data[0];
console.log(amounts.length);
for(var i=0; i<amounts.length; i++)
{
a = amounts[i];
console.log(a);
dao = baseToDAO(a[1]);
pc = formatFloat(100*a[1]/vol, 3) + "%";
$('#amountTable tbody').append(String.format("<tr><td><a class=\"accLink\">{0}</a></td><td>{1}</td><td>{2}</td></tr>", a[0], dao, pc));
}
});
$("#tokenpc").text(formatFloat(data[1]) + "%");
if(data[2] != 0){
$("#top50maj").collapse("show");
$("#n-maj").text(data[2]);
$("#pc-maj").text(formatFloat(data[3]) + "%");
}
$("#majInfo").collapse("show");
$('[data-toggle="tooltip"]').tooltip({
container : 'body'
});
accLink();
});
$('[data-toggle="tooltip"]').tooltip();
$("#searchaccount").on("input", function(){
hex = $(this).val()
if(hex.startsWith("0x")){
$("#hexprefix").html("");
console.log("C");
}
else{
$("#hexprefix").html("0x");
hex = "0x" + hex;
console.log("B");
}
hex = hex.toLowerCase();
var re = /^0[xX][0-9a-f]{40}$/
if(re.test(hex))
{
console.log("g");
$("#hexalert").removeClass("alert-danger").addClass("alert-success").html("Go").prop("title", "Valid address").tooltip('fixTitle').tooltip("show");
}
else{
console.log("x");
$("#hexalert").addClass("alert-danger").removeClass("alert-success").html("✘").prop("title", "Invalid address").tooltip('fixTitle').tooltip("hide");
}
}).trigger("input");
$("#searchaccount").keyup(function (e) {
if (e.keyCode == 13) {
window.location.href = "tokenbalance.html#" + $("#searchaccount").val();
}
});
$("#searchproposal").keyup(function (e) {
if (e.keyCode == 13) {
window.location.href = "proposal.html#" + $("#searchproposal").val();
}
});
</script>
<script src="https://www.w3counter.com/tracker.js?id=101014"></script>
</body>
</html>