-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
78 lines (73 loc) · 2.22 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>NGU Daily</title>
<meta name="description" content="NGU Daily">
<meta name="author" content="Justin Moon">
<link rel="stylesheet" href="styles.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Special+Elite&display=swap" rel="stylesheet">
<!-- Open Graph -->
<meta name="og:title" content="NGU Daily" />
<meta
name="og:url"
content="https://timdeschryver.dev/posts/gridsome-social-cards"
/>
<meta
name="og:description"
content="Average daily bitcoin price increase"
/>
<meta name="og:type" content="article" />
<meta
name="og:image"
content="https://ngudaily.com/social.jpeg"
/>
<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:creator" content="@_justinmoon_" />
<meta
name="twitter:title"
content="NGU Daily"
/>
<meta
name="twitter:description"
content="Average daily bitcoin price increase"
/>
<meta
name="twitter:image"
content="https://ngudaily.com/social.jpeg"
/>
</head>
<body>
<div class="container">
<div class="content">
<div>
<p class="text">On Average Bitcoin Goes Up</p>
<p class="number transparent" id="number">$4</p>
<p class="text">Every Day</p>
</div>
</div>
<footer>By <a class="handle" href="https://twitter.com/_justinmoon_"> @_justinmoon_</a> <span class="source">(<a href="https://github.com/justinmoon/ngudaily">source</a>)</span></footer>
</div>
</div>
<script>
function handleData(data) {
const genesis = new Date(2009, 1, 3);
const now = new Date();
const deltaSeconds = now.getTime() - genesis.getTime();
const deltaDays = deltaSeconds / (1000 * 3600 * 24);
const nguDaily = data.ticker.price / deltaDays;
const el = document.getElementById("number");
if (el) {
el.innerHTML = `\$${nguDaily.toFixed(2)}`;
el.classList.remove("transparent")
}
}
// TODO: error handling
fetch('https://api.cryptonator.com/api/ticker/btc-usd')
.then(response => response.json())
.then(data => handleData(data))
</script>
</body>
</html>