-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
109 lines (100 loc) · 2.67 KB
/
index.html
File metadata and controls
109 lines (100 loc) · 2.67 KB
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
<!DOCTYPE html>
<html>
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-W02LCCLH10"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-W02LCCLH10');
</script>
<title>Calm, guided breathing app</title>
<meta name="description" content="A guided breathing app.">
<link rel="manifest" href="manifest.json">
<link rel="icon" href="images/icon-192x192.png" type="image/png"/>
<style>
body {
text-align: center;
font-size: 40px;
user-select: none;
-webkit-user-select: none;
color: grey;
font-family: futura;
overflow-x: hidden
}
.i {
color: rgb(112, 168, 170);
}
button {
font-size: 50px;
color: white;
background: #2d7df3;
height: 80px;
padding: 10px 30px 20px 30px;
border-radius: 50px;
border: none;
}
#promotional {
width: 50%;
border-radius: 5px;
}
</style>
</head>
<body>
<p><span style="font-size:50px">Install Calm.</span><br><br><span class="i">A guided breathing app.</span></p>
<button id="download" onclick="app()">Get app</button>
<br><br>
<img id="promotional"/>
<script>
var d = document.getElementById("download");
var p = document.getElementById("promotional");
if (navigator.platform == "MacIntel") {
d.innerHTML = "Install web app";
p.src = "images/desktop.png";
} else if (navigator.platform == "iPhone") {
d.innerHTML = "GET";
p.src = "images/mobile.png";
p.style.border = "2px solid black";
} else if (navigator.platform == "Android") {
d.innerHTML = "Install";
p.src = "images/mobile.png";
p.style.border = "2px solid black";
} else {
p.src = "images/desktop.png";
}
function app() {
if (navigator.platform == "iPhone") {
alert("Click the \"Share\" button at the bottom of the screen, scroll down and click \"Add to home screen\".");
} else if (navigator.platform == "Android") {
alert("If an \"Add to home screen\" prompt did not pop up, click the menu button at the top of the screen, scroll down, and click \"Add to Home screen\".");
} else {
alert("Click the \"Install\" prompt in the address bar at the top of the window to install.");
location.replace("loading.html");
}
}
// dark mode
if (window.matchMedia &&
window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.body.style.background = "rgb(32, 33, 36)";
}
//pwa script
window.addEventListener('load', () => {
registerSW();
});
// Register the Service Worker
async function registerSW() {
if ('serviceWorker' in navigator) {
try {
await navigator
.serviceWorker
.register('serviceworker.js');
}
catch (e) {
console.log('SW registration failed');
}
}
}
</script>
</body>
</html>