-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
201 lines (190 loc) · 5.1 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<title>BRUSH Price</title>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<meta charset="UTF-8">
<meta name="description" content="PaintSwap Live Price Widget">
<meta name="keywords" content="paintswap,brush,ftm,amm">
<meta name="author" content="Paintoshi">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" href="./favicon.png"/>
</head>
<style>
html, body, .container {
height: 100%;
background-color: black;
color: #209348;
font-size: 16px;
font-family: sans-serif;
margin: 0;
}
a {
color: #58d668;
}
a:hover {
color: #74e883 !important;
cursor: pointer;
}
.container {
position: relative;
text-align: center;
background: linear-gradient(to bottom, #d41bc457, #1dc94314);
}
.container > div {
position: absolute;
left: 0;
right: 0;
top: 1%;
margin-top: -9px;
}
.big {
font-size: 30px;
line-height: 1.4;
color: #52d0d7;
}
.medium {
font-size: 15px;
line-height: 1.4;
margin-right: 10px;
color: #52d77c;
}
.header {
font-size: 50px;
height: 14vw;
margin-top: 16px;
}
.refreshed {
margin-top: 8px;
font-size: 12px;
}
#table {
border: 2px solid #209348;
background-color: #2093481c;
border-radius: 16px;
padding: 16px;
display: inline-block;
margin-top: 32px;
}
#table td {
padding-right: 10px;
}
@media only screen and (min-width: 510px) {
.container > div {
top: 4%;
margin-top: -9px;
}
.big {
font-size: 35px;
line-height: 1.3;
}
.medium {
font-size: 25px;
line-height: 1.3;
}
.header {
height: 12vw;
}
.refreshed {
font-size: 14px;
}
}
@media only screen and (min-width: 1200px) {
.container > div {
top: 20%;
margin-top: -9px;
}
.big {
font-size: 40px;
line-height: 1.5;
}
.medium {
font-size: 30px;
line-height: 1.5;
margin-right: 16px;
}
.header {
height: 7vw;
}
}
@media only screen and (min-width: 2000px) {
.header {
height: 5vw;
}
}
</style>
<body>
<div class="container">
<div style="display: flex; flex-direction: column; align-items: center;">
<a href="https://paintswap.finance/" target="_blank"><img class="header" src="logo.png" alt="PaintSwap" /></a>
<table id="table">
<tr>
<td style="text-align: right;">
<span class="medium">USD / BRUSH</span>
</td>
<td style="text-align: left;">
<span class="brush big"></span><br />
</td>
</tr>
<tr>
<td style="text-align: right;">
<span class="medium">FTM / BRUSH</span>
</td>
<td style="text-align: left;">
<span class="ftm big"></span><br />
</td>
</tr>
<tr>
<td style="text-align: right;">
<span class="medium">USD / FTM</span>
</td>
<td style="text-align: left;">
<span class="ftm-usd big"></span><br />
</td>
</tr>
<tr>
<td style="text-align: right;">
<span class="medium">SUPPLY</span>
</td>
<td style="text-align: left;">
<span class="mc big"></span><br />
</td>
</tr>
</table>
<span class="refreshed"></span>
</div>
</div>
<script>
function timeConverter(UNIX_timestamp){
const a = new Date(UNIX_timestamp * 1000)
const months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
const year = a.getFullYear()
const month = months[a.getMonth()]
const date = a.getDate()
const hour = ('0' + a.getHours()).slice(-2)
const min = ('0' + a.getMinutes()).slice(-2)
const sec = ('0' + a.getSeconds()).slice(-2)
const time = date + ' ' + month + ' ' + year + ' ' + hour + ':' + min + ':' + sec
return time
}
function checkPrice() {
$.getJSON('https://api.paintswap.finance/v2/tokens/0x85dec8c4B2680793661bCA91a8F129607571863d', function(data) {
const refreshed = `Last Updated: ${timeConverter(data.updated_at)}`;
const brush = parseFloat(data.token.price);
const ftm = parseFloat(data.token.price_FTM);
const ftmUsd = ftm > 0 ? parseFloat(brush/ftm) : 0;
$(".refreshed").html(refreshed);
$(".brush").html(`$${brush.toFixed(6)}`);
$(".ftm").html(ftm.toFixed(6));
$(".ftm-usd").html(`$${ftmUsd.toFixed(6)}`);
});
$.getJSON('https://api.paintswap.finance/supply', function(data) {
const mc = `$${parseFloat(data.circulating_supply_usd).toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 0})}`
$(".mc").html(mc);
});
}
checkPrice()
setInterval(checkPrice,10000);
</script>
</body>
</html>