-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
89 lines (80 loc) · 3.33 KB
/
index.html
File metadata and controls
89 lines (80 loc) · 3.33 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<meta name="theme-color" content="yellow" />
<link rel="stylesheet" href="./css/style.css" />
<title>Cheese</title>
<link rel="icon" href="./images/cheese2.png" type="image/png" />
<link rel="shortcut icon" href="./images/cheese2.png" type="image/png" />
<link rel="apple-touch-icon" sizes="120x120" href="./images/cheese2.png" />
<link rel="apple-touch-icon" sizes="152x152" href="./images/cheese2.png" />
<link rel="manifest" href="./manifest.json">
<meta name="description" content="Cheese Cheese Cheese Cheese Cheese Cheese Cheese Cheese Cheese Cheese Cheese Cheese Cheese">
<meta name="webOS-api-version" content="2">
<style>
.container {
display: flex;
flex-direction: column;
align-items: center;
}
.button {
margin: 20px;
}
</style>
</head>
<body>
<div class="container">
<button onclick="show()" class="button" id="button" tabindex="0">We like cheese</button>
<img id="image" src="" alt="Press the button" />
</div>
<div id="debug-output" style="position: fixed; bottom: 0; right: 0;"></div>
<audio id="sound">
<source src="" type="audio/mpeg">
</audio>
<script>
var debugOutput = document.getElementById('debug-output');
function log(message){
debugOutput.innerHTML += message + '<br>';
}
//LG webOS TV code
if (typeof webOS !== 'undefined' && typeof webOS.remoteControlManager !== 'undefined') {
log('webOS.remoteControlManager !== undefined');
var button = document.getElementById('button');
var remoteControlManager = new LGWebOSRemoteControlManager();
remoteControlManager.setFocusedElement(button);
}
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/cheese/service-worker.js', {scope: '/cheese/'});
}
let deferredPrompt;
window.addEventListener('beforeinstallprompt', (e) => {
e.preventDefault();
deferredPrompt=e;
})
window.addEventListener('load', function() {
document.getElementById('button').focus();
});
var shown = false;
function show() {
var r = Math.floor(Math.random()*34)+1;
var img=document.getElementById('image');
var sound=document.getElementById('sound');
if (r===34) {
r=Math.floor(Math.random()*34)+1;
}
if (r===34) {
img.src='images/potato.png';
sound.src='sounds/imposter.mp3';
} else {
img.src='images/cheese'+r+'.png';
sound.src='sounds/cheese'+r+'.mp3';
}
shown=true;
sound.play()
}
</script>
</body>
</html>