-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
233 lines (214 loc) · 9.69 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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<script async defer src="https://buttons.github.io/buttons.js"></script>
<link rel='icon' type="image/png" href="img/logo.png?=1">
<style>
h1 {
color: #D3C4BE;
}
body {
color: black;
}
html, body{
height: 100%;
}
p {
color: #696969;
font-size: 15pt;
}
.jumbotron{
position: relative;
color: black;
width: 100%;
}
.footer{
height: fit-content;
left: 0;
bottom: 0;
width: 100%;
color: #000000;
}
.github-button{
position: right;
}
</style>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<div class="title">
<title id="counter">Sugarchain Reward Half Countdown</title>
</div>
</head>
<div class="text-center container">
<p1><a href="https://sugarchain.org" target="_blank"><img src="img/logo_dark.png" style="position: center; width: 64px; height: 64px;"></a></p1>
</div>
<h1 style="text-align: center">Sugarchain Block Reward Half Countdown!</h1>
<div style="background: #696969 !important; width: 100%;" class="jumbotron text-center">
<h2 ><span id="hours">loading...</span><br>
Left until halving
</h2>
</div>
<body>
<table class="table table-striped table-sm" style="height: fit-content; width: 100%;">
<tbody>
<tr>
<th scope="row">
<td><p>Block Height: </p></td>
<td align="right"><p><span id="listblocks">loading...</span></p></td>
</th>
</tr>
<tr>
<th scope="row">
<td><p>Block Reward: </p></td>
<td align="right"><p><span id="reward">loading...</span></p></td>
</th>
</tr>
<tr>
<th scope="row">
<td><p>Remaining Blocks Left: </p></td>
<td align="right"><p><span id="blkleft">loading...</span></p></td>
</th>
</tr>
<tr>
<th scope="row">
<td><p>Current Network Difficulty: </p></td>
<td align="right"><p><span id="netDifficulty">loading...</span></p></td>
</th>
</tr>
<tr>
<th scope="row">
<td><p>Current Network Hashrate: </p></td>
<td align="right"><p><span id="netHashrate">loading...</span></p></td>
</th>
</tr>
<tr>
<th scope="row">
<td><p>Approx. Sugar Left to Mine: </p></td>
<td align="right"><p><span id="sugarLeft">loading...</span></p></td>
</th>
</tr>
<tr>
<th scope="row">
<td><p>Current Price SUGAR/USD: </p></td>
<td align="right"><p><span id="priceusd">loading...</span></p></td>
</th>
</tr>
<tr>
<th scope="row">
<td><p>Current Price SUGAR/BTC: </p></td>
<td align="right"><p><span id="pricebtc">loading...</span></p></td>
</th>
</tr>
</tbody>
</table>
</body>
<footer style="bottom: 0px;">
<div class="footer text-center">
<a class="github-button" href="https://github.com/Nugetzrul3/nugetzrul3.github.io/fork" data-color-scheme="no-preference: dark; light: dark; dark: dark" data-icon="octicon-repo-forked" data-show-count="true" aria-label="Fork Nugetzrul3/nugetzrul3.github.io on GitHub">Fork</a> <a style="position: absolute TOP;" class="github-button" href="https://github.com/Nugetzrul3/nugetzrul3.github.io" data-color-scheme="no-preference: dark; light: dark; dark: dark;" data-icon="octicon-star" data-show-count="true" aria-label="Star Nugetzrul3/nugetzrul3.github.io on GitHub">Star</a><br><a class="github-button" href="https://github.com/Nugetzrul3" data-color-scheme="no-preference: dark; light: dark; dark: dark;" aria-label="Follow @Nugetzrul3 on GitHub" data-show-count="true">Follow @Nugetzrul3</a> <a class="github-button" href="https://github.com/volbil" data-color-scheme="no-preference: dark; light: dark; dark: dark;" aria-label="Follow @volbil on GitHub" data-show-count="true">Follow @volbil</a>
</div>
</footer>
<script>
api = "https://api.sugarchain.org"
function getPrice() {
return Promise.resolve($.ajax({
url: api + "/price",
dataType: 'json',
type: 'GET',
}))
}
function getInfo() {
return Promise.resolve($.ajax({
url: api + "/info",
dataType: "json",
type: "GET"
}))
}
n = 1
function setInfo() {
getInfo().then(function (data) {
var height = data.result.blocks
var getReward = parseInt(data.result.reward)
var blockReward = getReward / 100000000
var half = 12500000 * n
var remainheight = half - height
var netDiff = parseFloat(data.result.difficulty)
var netHash = data.result.nethash
$("#listblocks").text(height)
$("#reward").text(blockReward)
$("#blkleft").text(remainheight)
if (document.getElementById("blkleft").innerHTML == "0") {
n++
}
else if (document.getElementById("blkleft").innerHTML > "0") {
n
}
var amountLeft = Math.round((document.getElementById("blkleft").innerHTML) * (document.getElementById("reward").innerHTML))
$("#hours").text(secondsToHms((remainheight * 5) + 691200))
$("#netDifficulty").text(netDiff)
$("#netHashrate").text(convertHashFormat(netHash))
$("#sugarLeft").text(amountLeft)
})
}
function secondsToHms(d) {
d = Number(d);
var hours = Math.floor(d / 3600);
var m = Math.floor(d % 3600 / 60);
var s = Math.floor(d % 3600 % 60);
var day = Math.floor(hours / 24)
var h = hours - (day * 24)
return (day) + " Days, " + (h) + 'h' +":" + ('0' + m).slice(-2) + 'm' + ":" + ('0' + s).slice(-2) + 's';
}
function convertHashFormat(hashes = 0) {
if (hashes < 1e3) {
return hashes + " H/s"
}
else if (hashes > 1e3 && hashes < 1e6) {
return (hashes / 1e3).toFixed(3) + " KH/s"
}
else if (hashes > 1e6 && hashes < 1e9) {
return (hashes / 1e6).toFixed(3) + " MH/s"
}
else if (hashes > 1e9 && hashes < 1e12) {
return (hashes / 1e9).toFixed(3) + " GH/s"
}
else if (hashes > 1e12 && hashes < 1e15) {
return (hashes / 1e12).toFixed(3) + " TH/s"
}
else if (hashes > 1e15 && hashes < 1e18) {
return (hashes / 1e15).toFixed(3) + " PH/s"
}
else if (hashes > 1e18 && hashes < 1e21) {
return (hashes / 1e18).toFixed(3) + " EH/s"
}
}
function getCurrentPrice() {
getPrice().then(function(data) {
priceUSD = parseFloat(data.result.usd)
getpriceBTC = data.result.btc
priceBTC = Number(getpriceBTC).toLocaleString(undefined, {minimumFractionDigits: 8, maximumFractionDigits: 8})
$("#priceusd").text("$" + priceUSD)
$("#pricebtc").text(priceBTC + "BTC")
})
}
setInterval(function() {
setInfo()
getCurrentPrice()
}, 2000)
$("#hours").hover(function() {
$(this).stop().animate({
fontSize: "2em"
}, 1000);
},
function() {
$(this).stop().animate({
fontSize: "1em"
}, 1000);
});
</script>
</html>