-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoken.html
More file actions
223 lines (193 loc) · 8.76 KB
/
token.html
File metadata and controls
223 lines (193 loc) · 8.76 KB
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>场内TOKEN 比例</title>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/pako/1.0.6/pako_inflate.min.js"></script>
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<style>
body {
padding-top: 50px;
padding-bottom: 20px;
display:-webkit-flex;
display:-ms-flexbox;
display:flex;
-webkit-align-items:center;
-ms-flex-align:center;
align-items:center;
-webkit-justify-content:center;
-ms-flex-pack:center;
justify-content:center;
}
tr th,td{
text-align: center;
}
p{;font-size:1em;font-weight:bold;font-family:"微软雅黑";}
p span {
display:inline-block;
position:relative;
-webkit-transform-style:preserve-3d;
transform-style:preserve-3d;
-webkit-perspective:500;
perspective:500;
-webkit-font-smoothing:antialiased;
}
p span::before,
p span::after {
display:none;
position:absolute;
top:0;
left:-1px;
-webkit-transform-origin:left top;
-ms-transform-origin:left top;
transform-origin:left top;
-webkit-transition:all ease-out 0.3s;
transition:all ease-out 0.3s;
content:attr(data-text);
}
p span::before {
z-index:1;
color:rgba(0,0,0,0.2);
-webkit-transform:scale(1.1, 1) skew(0deg, 20deg);
-ms-transform:scale(1.1, 1) skew(0deg, 20deg);
transform:scale(1.1, 1) skew(0deg, 20deg);
}
p span::after {
z-index:2;
color:#d7d1e4;
text-shadow:-1px 0 1px #684da3, 1px 0 1px rgba(0,0,0,0.8);
-webkit-transform:rotateY(-40deg);
transform:rotateY(-40deg);
}
p span:hover::before {
-webkit-transform:scale(1.1, 1) skew(0deg, 5deg);
-ms-transform:scale(1.1, 1) skew(0deg, 5deg);
transform:scale(1.1, 1) skew(0deg, 5deg);
}
p span:hover::after {
-webkit-transform:rotateY(-10deg);
transform:rotateY(-10deg);
}
p span + span {
margin-left:0.1em;
}
@media (min-width:20em) {
p {
font-size:2em;
}
p span::before,
p span::after {
display:block;
}
}
@media (min-width:30em) {
p {
font-size:3em;
}
}
@media (min-width:40em) {
p {
font-size:5em;
}
}
@media (min-width:60em) {
p {
font-size:8em;
}
}
</style>
</head>
<body>
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>币种</th>
<th>数量</th>
<th>总量</th>
<th>占比</th>
</tr>
</thead>
<tbody>
<tr id="INS">
<th scope="row">INS</th>
<td class="balance">/</td>
<td class="total">/</td>
<td class="percent">/</td>
</tr>
<tr id="APPC">
<th scope="row">APPC</th>
<td class="balance">/</td>
<td class="total">/</td>
<td class="percent">/</td>
</tr>
<tr id="CND">
<th scope="row">CND</th>
<td class="balance">/</td>
<td class="total">/</td>
<td class="percent">/</td>
</tr>
</tbody>
</table>
</div>
<script>
!function(a,b){"function"==typeof define&&define.amd?define([],b):"undefined"!=typeof module&&module.exports?module.exports=b():a.ReconnectingWebSocket=b()}(this,function(){function a(b,c,d,e){function l(a,b){var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,!1,!1,b),c}var e={debug:!1,automaticOpen:!0,reconnectInterval:1e3,maxReconnectInterval:3e4,reconnectDecay:1.5,timeoutInterval:2e3};d||(d={});for(var f in e)this[f]="undefined"!=typeof d[f]?d[f]:e[f];this.url=b,this.buff=e,this.reconnectAttempts=0,this.readyState=WebSocket.CONNECTING,this.protocol=null;var h,g=this,i=!1,j=!1,k=document.createElement("div");k.addEventListener("open",function(a){g.onopen(a)}),k.addEventListener("close",function(a){g.onclose(a)}),k.addEventListener("connecting",function(a){g.onconnecting(a)}),k.addEventListener("message",function(a){g.onmessage(a)}),k.addEventListener("error",function(a){g.onerror(a)}),this.addEventListener=k.addEventListener.bind(k),this.removeEventListener=k.removeEventListener.bind(k),this.dispatchEvent=k.dispatchEvent.bind(k),this.open=function(b){h=new WebSocket(g.url,c||[]),h.binaryType = g.buff?"arraybuffer":"",b||k.dispatchEvent(l("connecting")),(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","attempt-connect",g.url);var d=h,e=setTimeout(function(){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","connection-timeout",g.url),j=!0,d.close(),j=!1},g.timeoutInterval);h.onopen=function(){clearTimeout(e),(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onopen",g.url),g.protocol=h.protocol,g.readyState=WebSocket.OPEN,g.reconnectAttempts=0;var d=l("open");d.isReconnect=b,b=!1,k.dispatchEvent(d)},h.onclose=function(c){if(clearTimeout(e),h=null,i)g.readyState=WebSocket.CLOSED,k.dispatchEvent(l("close"));else{g.readyState=WebSocket.CONNECTING;var d=l("connecting");d.code=c.code,d.reason=c.reason,d.wasClean=c.wasClean,k.dispatchEvent(d),b||j||((g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onclose",g.url),k.dispatchEvent(l("close")));var e=g.reconnectInterval*Math.pow(g.reconnectDecay,g.reconnectAttempts);setTimeout(function(){g.reconnectAttempts++,g.open(!0)},e>g.maxReconnectInterval?g.maxReconnectInterval:e)}},h.onmessage=function(b){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onmessage",g.url,b.data);var c=l("message");c.data=b.data,k.dispatchEvent(c)},h.onerror=function(b){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onerror",g.url,b),k.dispatchEvent(l("error"))}},1==this.automaticOpen&&this.open(!1),this.send=function(b){if(h)return(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","send",g.url,b),h.send(b);throw"INVALID_STATE_ERR : Pausing to reconnect websocket"},this.close=function(a,b){"undefined"==typeof a&&(a=1e3),i=!0,h&&h.close(a,b)},this.refresh=function(){h&&h.close()}}return a.prototype.onopen=function(){},a.prototype.onclose=function(){},a.prototype.onconnecting=function(){},a.prototype.onmessage=function(){},a.prototype.onerror=function(){},a.debugAll=!1,a.CONNECTING=WebSocket.CONNECTING,a.OPEN=WebSocket.OPEN,a.CLOSING=WebSocket.CLOSING,a.CLOSED=WebSocket.CLOSED,a});
self.setInterval(function(){
var Biance_Address = "0x3f5ce5fbfe3e9af3971dd833d26ba9b5c936f0be";
getTokenData("INS","0x5b2e4a700dfbc560061e957edec8f6eeeb74a320",Biance_Address,10);
getTokenData("APPC","0x1a7a8bd9106f2b8d977e08582dc7d24c723ab0db",Biance_Address,18);
getTokenData("CND","0xd4c435f5b09f855c3317c8524cb1f586e42795fa",Biance_Address,18);
},2000);
function ajax_(url,type,success){
$.ajax({type: "get",async: false,url: url, dataType: type,success: success});
}
String.prototype.format = function(args) {
if (arguments.length>0) {
var result = this;
if (arguments.length == 1 && typeof (args) == "object") {
for (var key in args) {
var reg=new RegExp ("({"+key+"})","g");
result = result.replace(reg, args[key]);
}
}
else {
for (var i = 0; i < arguments.length; i++) {
if(arguments[i]==undefined)
{
return "";
}
else
{
var reg=new RegExp ("({["+i+"]})","g");
result = result.replace(reg, arguments[i]);
}
}
}
return result;
}
else {
return this;
}
}
function getTokenData(token_name,contract_address,user_address,decimal){
var API_TOKEN="P748NK23R7I2J48D5UD727GMTSATI5DI7C";
var API_BALANCE="https://api.etherscan.io/api?module=account&action=tokenbalance&contractaddress={Contract_Address}&address={User_Address}&tag=latest&apikey={Api_Token}";
var API_SUPPLY = "https://api.etherscan.io/api?module=stats&action=tokensupply&contractaddress={Contract_Address}&apikey={Api_Token}"
var total,balance;
ajax_(API_SUPPLY.format({"Contract_Address":contract_address,Api_Token:API_TOKEN}),'json',function(data){
total = data['result']/Math.pow(10,decimal);
$("#"+token_name+" td.total").html(total)
});
ajax_(API_BALANCE.format({"Contract_Address":contract_address,"User_Address":user_address,Api_Token:API_TOKEN}),'json',function(data){
balance = parseFloat(data['result'])/Math.pow(10,decimal)
percent =100*balance/total
$("#"+token_name+" td.balance").html(balance)
$("#"+token_name+" td.percent").html(percent.toString()+"%")
});
}
</script>
</body>
</html>