-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
96 lines (72 loc) · 2.26 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
<body>
<div class="centered">
<h1>Christopher W Moriarty</h1>
<a href="Chris%20Moriarty%20-%20Resume.pdf">resume</a><br>
<a href="https://github.com/cwmoriarty">github</a><br>
<a href="https://www.linkedin.com/in/cwmoriarty/">linkedin</a><br>
<br>
<br>
☀️ <a href="https://sunblock.app">sunblock.app</a><br>
🔤 <a href="https://speak-n-spell.app">speak-n-spell.app</a><br>
📭 <a href="https://cwmoriarty.com/optout-guide">optout guide</a>
<br><Br>
<tt>cwmⓐcwmoriarty.com</tt><br><br>
</div>
<div class="libleft">
<small><span id="flag">🌎</span> <span id="distance">0</span> miles away</small>
</div>
</body>
<script type="text/javascript">
//Distance calculation
R = 3959
fetch('https://ipapi.co/json').then(response => response.json()).then(data => {
dLat = (atob("NDIuNTU=") - data.latitude) * Math.PI / 180 // Radians keep me safe.
dLon = (atob("LTcwLjg3") - data.longitude) * Math.PI / 180
a =
Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(data.latitude * Math.PI / 180) * Math.cos(42.55 * Math.PI / 180) *
Math.sin(dLon / 2) * Math.sin(dLon / 2)
c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
distance = (R * c).toFixed(0);
//Flag Emoji
codePoints = data.country_code.toUpperCase().split('').map(char => 127397 + char.charCodeAt())
flagEmoji= String.fromCodePoint(...codePoints)
document.getElementById("distance").innerHTML = distance;
document.getElementById("flag").innerHTML = flagEmoji;
console.log(flagEmoji)
})
.catch(error => {
console.error("Error fetching IP data:", error);
});
</script>
<style type="text/css">
body { font-family: Helvetica, Geneva, sans-serif; }
a { color: black; }
li { list-style-type: none; padding-left: 20px}
.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 50%;
height: 50%;
font-size: calc(1vw + 1vh);
/*border: 1px solid black*/;
}
.centered h1
{
font-size: calc(2vw + 2vh);
}
@media (max-width: 768px) {
.centered {
width: 50%;
height: 50%;
font-size: calc(2vw + 2vh);
}
}
.libleft {
position: fixed;
left:10;
bottom:10;
}
</style>