-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
87 lines (78 loc) · 2.95 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<title>GPS Slate</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Disable tap highlight on IE -->
<meta name="msapplication-tap-highlight" content="no">
<!-- Web Application Manifest -->
<link rel="manifest" href="manifest.json">
<!-- Add to homescreen for Chrome on Android -->
<meta name="mobile-web-app-capable" content="yes">
<meta name="application-name" content="GPS Slate">
<link rel="icon" sizes="192x192" href="app-icon.png">
<!-- Add to homescreen for Safari on iOS -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="GPS Slate">
<link rel="apple-touch-icon" sizes="180x180" href="app-icon.png">
<!-- Tile icon for Win8 (144x144 + tile color) -->
<meta name="msapplication-TileImage" content="app-icon.png">
<meta name="msapplication-TileColor" content="#000000">
<!-- Color the status bar on mobile devices -->
<meta name="theme-color" content="#000000">
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
</head>
<body>
<main>
<h1 class="lat">Lat:</h1>
<h1 class="long">Long:</h1>
<h1 class="time">Time:</h1>
</main>
<style>
body {margin: 0; padding: 0;}
main {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
height: 100vh;
max-height: 100vh;
width: 100vw;
}
h1 {
font-family: "Helvetica Neue", sans-serif;
font-size: 30vh;
margin: 0;
padding: 0;
max-width: 100vw;
max-height: 33vh;
}
</style>
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('sw.js').then(function(registration) {
// Registration was successful
console.log('ServiceWorker registration successful with scope: ', registration.scope);
}).catch(function(err) {
// registration failed :(
console.log('ServiceWorker registration failed: ', err);
});
});
}
navigator.geolocation.getCurrentPosition(function(position) {
var lat = position.coords.latitude;
var long = position.coords.longitude;
document.querySelector(".lat").innerHTML = Math.round(lat * 100000) / 100000;
document.querySelector(".long").innerHTML = Math.round(long * 100000) / 100000;
var now = new Date();
document.querySelector(".time").innerHTML = `${now.getHours()} : ${now.getMinutes()}`
});
</script>
</body>
</html>