-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
277 lines (233 loc) · 9.52 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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<!DOCTYPE html>
<html>
<head>
<title>QrodexFinance Status</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/segoe-fonts.min.css">
<link rel="stylesheet" href="./din-next-lt/din-next.css">
<style>
H1, H2, H3{
display: inline-block;
}
BODY {
height: 100VH;
width: 100VW;
overflow: hidden;
}
html {
background-image: url('https://source.unsplash.com/1600x900/?landscape');
background-position: center;
background-size: cover;
background-repeat: no-repeat;
background-color: black;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "DIN Next LT";
text-shadow: 2px 2px 10px #000000;
color: white;
transition: background 0.5s ease;
}
.carousel-container {
width: 100%;
height: calc(100vh - 125px);
overflow: hidden;
position: relative;
backdrop-filter: blur(10px);
}
.carousel-item {
width: 100%;
height: 100%;
overflow: hidden;
align-items: center;
position: absolute;
transition: transform 0.5s ease-in-out;
display: grid;
place-content: center;
text-align: center;
}
#bottompart {
position: absolute;
bottom: 0;
width: 100vw;
padding: 25px;
background-color: #1d1d1d50;
backdrop-filter: blur(25px);
}
#time, #date {
float: right;
}
#timeanddate {
position: absolute;
z-index: 1;
bottom: 0;
right: 0;
padding: 25px;
}
</style>
</head>
<body>
<div class="carousel-container">
<div class="carousel-item">
<h2>Exchange price (IRL):</h2><br>
<h4 ID="idrexchange">-</h4>
</div>
<div class="carousel-item" style="transform: translateX(100%);">
<h2>Exchange price:</h2><br>
<h4 ID="allprices">-</h4>
</div>
<div class="carousel-item" style="transform: translateX(100%);">
<h2>Transaction history:</h2><br>
<h4 ID="transactionshistory">LOADING</h4>
</div>
<div class="carousel-item" style="transform: translateX(100%);">
<h2>Running miners:</h2><br>
<h4 ID="minerslist">-</h4>
</div>
</div>
<div id="bottompart">
<h4 ID="transactions">LOADING</h4>
<h4 ID="miners">LOADING</h4>
<h1 id="balance">LOADING</h1>
</div>
<div id="timeanddate">
<h4 id="wttr"></h4>
<h4 id="date"></h4>
<br>
<h1 id="time"></h1>
</div>
<script defer>
async function fetchValue() {
//set up and fetch account info
let myinfo = await fetch('https://server.duinocoin.com/users/InsuDex');
let val = await myinfo.json()
let alltransactions = ''
let allminers = ''
let allprices = ''
//balance, transactions and miners indicator
document.getElementById('balance').innerText = val.result.balance.balance + ' DUCOs'
document.getElementById('transactions').innerText = val.result.transactions.length + ' Transactions'
document.getElementById('miners').innerText = val.result.miners.length + ' Miners running'
//fetch exchange
let exchange = await fetch('https://server.duinocoin.com/v2/users/InsuDex');
let exchangeinfo = await exchange.json()
//format transactions
val.result.transactions.forEach(function (item) {
let formatted = "- " + item.sender + " > " + item.recipient + " (" + item.amount + " DUCOs) <BR>"
alltransactions = formatted + alltransactions
})
//format miners
if (val.result.miners.length == 0) {
allminers = "No miners running!"
}
val.result.miners.forEach(function (item, index) {
let formatted = "- " + item.identifier + " - " + item.software + "<BR>"
allminers = allminers + formatted
})
//format crypto exchange
for (const key in exchangeinfo.result.prices) {
let currkey = key.charAt(0).toUpperCase() + key.slice(1)
const value = exchangeinfo.result.prices[key];
allprices = allprices + `- ${currkey}: ${value} <br>`;
}
//apply transactions, miners and prices to their places
document.getElementById('transactionshistory').innerHTML = alltransactions
document.getElementById('minerslist').innerHTML = allminers
document.getElementById('allprices').innerHTML = allprices
let CURRexchange = await fetch('https://api.exchangerate-api.com/v4/latest/USD');
let CURRexchangeinfo = await CURRexchange.json()
let price = exchangeinfo.result.prices.max * val.result.balance.balance
let convertedtoIDR = price * CURRexchangeinfo.rates.IDR
let convertedtoRM = price * CURRexchangeinfo.rates.MYR
let formattedpricetext = `
- ${price.toLocaleString()} USD
<br>
- ${convertedtoIDR.toLocaleString()} IDR
<br>
- ${convertedtoRM.toLocaleString()} MYR
<br><br>
Or
<br><br>
- ${(convertedtoIDR / 250).toLocaleString()} Kopiko Candies
<br>
- ${(convertedtoIDR / 500).toLocaleString()} Cripca
<br>
- ${(convertedtoIDR / 3500).toLocaleString()} Teh Pucuk Harum
<br>
- ${(convertedtoIDR / 5000).toLocaleString()} Cilok
<br>
- ${(convertedtoIDR / 7000).toLocaleString()} Mie Oven
<br><br>
<a href="https://www.exchangerate-api.com">Rates By Exchange Rate API</a>
`
document.getElementById('idrexchange').innerHTML = formattedpricetext;
}
fetchValue()
//set carousel elements
const carouselContainer = document.querySelector('.carousel-container');
const carouselItems = document.querySelectorAll('.carousel-item');
let currentItem = 0;
//animate carousel
function showNextItem() {
carouselItems[currentItem].style.transform = 'translateX(100%)';
setTimeout(function () {
currentItem = (currentItem + 1) % carouselItems.length;
carouselItems[currentItem].style.display = 'none'
carouselItems[currentItem].style.transform = 'translateX(-100%)';
setTimeout(function () {
carouselItems[currentItem].style.display = 'grid'
setTimeout(function () {
carouselItems[currentItem].style.transform = 'translateX(0)';
}, 250)
}, 250)
}, 250)
}
function time() {
var d = new Date();
var s = d.getSeconds();
var m = d.getMinutes();
var h = d.getHours();
const currentDate = new Date();
const dayOfWeek = currentDate.toLocaleString('en-US', { weekday: 'long' });
const dayOfMonth = currentDate.getDate();
const month = currentDate.toLocaleString('en-US', { month: 'long' });
const year = currentDate.getFullYear();
const formattedDate = `${dayOfWeek}, ${dayOfMonth} ${month} ${year}`;
document.getElementById('time').textContent = (" ") + ("0" + h).substr(-2) + ":" + ("0" + m).substr(-2);
document.getElementById('date').textContent = formattedDate;
};
async function refreshBackground() {
let fetchimage = await fetch('https://source.unsplash.com/1600x900/?landscape')
let fetchedimage = await fetchimage.blob()
document.documentElement.style.backgroundImage = `none`
document.documentElement.style.backgroundImage = `url('${URL.createObjectURL(fetchedimage)}')`
}
async function fetchWeather() {
let fetchweather = await fetch('https://wttr.in/?format=3')
let fetchedweather = await fetchweather.text()
document.getElementById('wttr').textContent = fetchedweather;
}
document.documentElement.onclick = function () {
toNextItem = 0
showNextItem()
}
fetchWeather()
var toNextItem = 0;
function nextItemTimer() {
if (toNextItem < 6) {
toNextItem += 1
} else {
toNextItem = 0
showNextItem()
}
}
//loops
setInterval(time)
setInterval(nextItemTimer, 1000);
setInterval(fetchValue, 1000);
setInterval(refreshBackground, 300000);
setInterval(fetchWeather, 1000)
</script>
</body>
</html>