-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
120 lines (109 loc) · 3.46 KB
/
index.html
File metadata and controls
120 lines (109 loc) · 3.46 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
110
111
112
113
114
115
116
117
118
119
120
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Discourage aggressive HTML/asset caching, especially on iOS Safari, so new
deploys are picked up without the user having to clear site data. The
server-side Cache-Control headers are still authoritative; these meta tags
are a best-effort hint for clients that don't get that far. -->
<meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate, max-age=0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<title>Motion & GPS Telemetry</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
background-color: #f4f4f9;
}
h1 {
color: #333;
}
p {
margin-bottom: 15px;
}
label {
display: inline-block;
width: 150px;
font-weight: bold;
}
input, button {
padding: 8px;
border-radius: 4px;
border: 1px solid #ccc;
}
button {
margin-left: 10px;
}
h2 {
color: #555;
margin-top: 30px;
}
footer {
text-align: center;
padding-top: 30px;
border-top: 1px solid #ccc;
}
</style>
</head>
<body>
<h1>Motion & GPS Telemetry</h1>
<p>
<label for="name">Name:</label>
<input type="text" id="name">
</p>
<p>
<label for="interval">Telemetry Interval (ms):</label>
<input type="number" id="interval" value="500" min="100">
</p>
<p>
<button id="requestPermission" style="background-color: #4CAF50; color: white;">Start Sensors</button>
<button id="pauseTracking" style="background-color: #ccc; color: black;">Pause Sensors</button>
</p>
<h2>Accelerometer</h2>
<p id="accel">Waiting for data...</p>
<h2>Gyroscope</h2>
<p id="gyro">Waiting for data...</p>
<h2>GPS</h2>
<p id="gps">Waiting for data...</p>
<footer>
<p><small>Frontend version: <span id="version"></span></small></p>
</footer>
<script src="motion_capture.js?v=dev"></script>
<script>
// iOS Safari aggressively restores pages from the back/forward cache (bfcache).
// When a page is shown from bfcache, `event.persisted` is true and our scripts
// never re-run, so a freshly deployed version is silently ignored. Force a
// network reload in that case so users always run the current build.
window.addEventListener('pageshow', (event) => {
if (event.persisted) {
window.location.reload();
}
});
async function requestWakeLock() {
if (!('wakeLock' in navigator)) {
console.warn('Wake Lock API not supported in this browser.');
return;
}
let wakeLock = null;
async function acquire() {
try {
wakeLock = await navigator.wakeLock.request('screen');
console.log('Wake Lock active');
} catch (err) {
console.error(err.name + ': ' + err.message);
}
}
await acquire();
document.addEventListener('visibilitychange', async () => {
if (document.visibilityState === 'visible') {
await acquire();
}
});
}
requestWakeLock();
</script>
</body>
</html>