-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
49 lines (48 loc) · 1.43 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
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="manifest" href="manifest.json">
<script type="text/javascript">
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js')
.then(function(registration) {
console.log('Registration successful, scope is:', registration.scope);
})
.catch(function(error) {
console.log('Service worker registration failed, error:', error);
});
}
</script>
<style>
button {
width: 100%;
color: blue;
padding: 60px;
font-size: 70px;
font-weight: bold;
}
</style>
<script>
async function executeCommand(command) {
try {
window.navigator.vibrate(70);
} catch (e) {
// nothing
}
const xhr = new XMLHttpRequest();
xhr.open('POST', `commands/${command}`, true);
xhr.send();
}
</script>
</head>
<body>
<div><button onclick="executeCommand('audio_mute')">Mute</button></div>
<div><button onclick="executeCommand('audio_play')">Play</button></div>
<div><button onclick="executeCommand('audio_pause')">Pause</button></div>
<div><button onclick="executeCommand('audio_prev')">Prev</button></div>
<div><button onclick="executeCommand('audio_next')">Next</button></div>
<div><button onclick="executeCommand('audio_vol_down')">Vol -</button></div>
<div><button onclick="executeCommand('audio_vol_up')">Vol +</button></div>
</body>
</html>