-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
111 lines (106 loc) · 2.79 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<link rel="manifest" href="manifest.json">
<meta name="description" content="A simple PWA that doesn't really do much, for research into how to create one">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="application-name" content="TestPWA">
<meta name="apple-mobile-web-app-title" content="TestPWA">
<meta name="theme-color" content="#008000">
<meta name="msapplication-navbutton-color" content="#008000">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="msapplication-starturl" content="./">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="icon" type="image/png" sizes="512x512" href="appicon.png">
<link rel="apple-touch-icon" type="image/png" sizes="512x512" href="appicon.png">
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('sw.js')
.then(function(reg) {
// registration succeeded
}).catch(function(error) {
// registration failed
console.log('Registration failed with ' + error);
});
}
</script>
<style>
*
{
font-style: normal;
font-size: 24px;
}
table
{
width: 100%;
max-width: 400px;
margin-left: auto;
margin-right: auto;
}
.status
{
height: 30px;
width: 30px;
text-align: center;
}
.up
{
color: #008000;
}
.down
{
color: #FF0000;
}
.up, .down
{
display: none;
}
</style>
<title>Arucard Status</title>
</head>
<body onload="checkAvailability()">
<main>
<table style="width:100%">
<tr>
<th colspan="2">Availability</th>
</tr>
<tr id="github">
<td class="name">
<a href="https://arucard21.github.io/pwa-research/">arucard21 GitHub Page</a>
</td>
<td class="status">
<img alt="Checking status" class="loading" src="spinning-circles.svg" />
<div class="down">❌</div>
<div class="up">✓</div>
</td>
</tr>
</table>
</main>
<script>
function checkAvailability(){
isUp('github');
}
function isUp(row) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4) {
document.querySelectorAll('#'+row+' > .status > .loading')[0].style.display = 'none';
if (this.status == 200){
document.querySelectorAll('#'+row+' > .status > .up')[0].style.display = 'inline';
document.querySelectorAll('#'+row+' > .status > .down')[0].style.display = 'none';
}
else{
document.querySelectorAll('#'+row+' > .status > .up')[0].style.display = 'none';
document.querySelectorAll('#'+row+' > .status > .down')[0].style.display = 'inline';
}
}
};
xhttp.open("HEAD", document.querySelectorAll('#'+row+' > .name > a')[0].getAttribute('href'), true);
xhttp.setRequestHeader('Cache-Control', 'no-cache');
xhttp.send();
}
</script>
</body>
</html>