-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
271 lines (252 loc) · 9.97 KB
/
Copy pathindex.html
File metadata and controls
271 lines (252 loc) · 9.97 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<!-- interactive-widget=resizes-content: when the on-screen keyboard opens,
the layout viewport shrinks and the whole UI reflows above the keys
instead of getting scrolled/chopped off screen -->
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, interactive-widget=resizes-content"
/>
<meta name="theme-color" content="#7c4dff" />
<meta name="mobile-web-app-capable" content="yes" />
<link rel="manifest" href="./manifest.webmanifest" />
<link rel="icon" type="image/png" href="./icons/icon-192.png" />
<link rel="apple-touch-icon" href="./icons/icon-192.png" />
<title>Hacker Baby</title>
<style>
/* Critical boot styles, inlined so the first paint is never unstyled:
everything stays hidden behind a loader until the app is ready. */
html,
body {
margin: 0;
height: 100%;
background: #1a0b2e;
overflow: hidden;
}
body.booting > *:not(#app-loading) {
display: none !important;
}
#app-loading {
position: fixed;
inset: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 22px;
background: radial-gradient(circle at 50% 40%, #4527a0, #1a0b2e 75%);
z-index: 999;
transition: opacity 0.45s;
}
#app-loading.done {
opacity: 0;
pointer-events: none;
}
#app-loading .star {
font-size: 64px;
animation: hb-spin 1.2s ease-in-out infinite;
}
#app-loading .dots {
display: flex;
gap: 10px;
}
#app-loading .dots span {
width: 14px;
height: 14px;
border-radius: 50%;
animation: hb-bounce 1s ease-in-out infinite;
}
#app-loading .dots span:nth-child(1) {
background: #ff5252;
}
#app-loading .dots span:nth-child(2) {
background: #ffee58;
animation-delay: 0.15s;
}
#app-loading .dots span:nth-child(3) {
background: #69f0ae;
animation-delay: 0.3s;
}
@keyframes hb-spin {
0% {
transform: rotate(0) scale(1);
}
50% {
transform: rotate(180deg) scale(1.25);
}
100% {
transform: rotate(360deg) scale(1);
}
}
@keyframes hb-bounce {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-12px);
}
}
</style>
</head>
<body class="booting">
<div id="app-loading">
<div class="star">⭐</div>
<div class="dots"><span></span><span></span><span></span></div>
</div>
<canvas id="scene"></canvas>
<div id="picture-mode" class="overlay hidden">
<div id="card-stage">
<div id="card-picture"></div>
<div id="card-word"></div>
<div id="mic-status">🎤</div>
<div id="card-timer"><div id="card-timer-fill"></div></div>
</div>
</div>
<div id="mirror-mode" class="overlay hidden">
<div id="mirror-frame">
<video id="mirror-video" autoplay playsinline muted></video>
<canvas id="mirror-snap" class="hidden"></canvas>
<div id="mirror-flash"></div>
</div>
</div>
<div id="mode-bar">
<button id="mode-letters" class="mode-btn active" aria-label="Letter game">🔤</button>
<button id="mode-pictures" class="mode-btn" aria-label="Picture game">🖼️</button>
<button id="mode-mirror" class="mode-btn" aria-label="Mirror">🪞</button>
<button id="music-toggle" class="mode-btn" aria-label="Music">🎵</button>
<button id="pause-toggle" class="mode-btn" aria-label="Pause">⏸️</button>
<button id="fullscreen-toggle" class="mode-btn" aria-label="Fullscreen">⛶</button>
<button id="config-button" class="mode-btn" aria-label="Settings">⚙️</button>
</div>
<div id="config-gate" class="overlay hidden">
<div id="config-gate-card">
<button id="config-gate-close" class="cfg-x" aria-label="Close">✕</button>
<div id="config-gate-emoji">🔒</div>
<h2>Grown-ups only</h2>
<p>Type <strong>config</strong> to open the settings</p>
<input
id="config-gate-input"
type="text"
autocomplete="off"
autocapitalize="none"
autocorrect="off"
spellcheck="false"
placeholder="type here…"
/>
</div>
</div>
<div id="score-badge" class="hidden">⭐ 0</div>
<button id="kbd-button" class="hidden" aria-label="Show keyboard">⌨️</button>
<input
id="kbd-input"
type="text"
autocomplete="off"
autocapitalize="characters"
autocorrect="off"
spellcheck="false"
aria-hidden="true"
tabindex="-1"
/>
<div id="pause-overlay" class="overlay hidden">
<button id="resume-button">▶</button>
</div>
<div id="yt-holder"></div>
<div id="parent-hotspot" title=""></div>
<div id="parent-panel" class="overlay hidden">
<div id="parent-card">
<header id="parent-header">
<h2>⚙️ Grown-ups</h2>
<button id="parent-close" class="cfg-x" aria-label="Close">✕</button>
</header>
<div id="parent-body">
<section class="cfg-section">
<h3>Quick controls</h3>
<div class="cfg-row">
<button id="parent-fullscreen" class="cfg-btn">⛶ Fullscreen</button>
<button id="parent-music" class="cfg-btn">🎵 Music</button>
<button id="parent-voice" class="cfg-btn">🗣️ Repeat prompt</button>
</div>
</section>
<section class="cfg-section">
<h3>🔤 Letter game difficulty</h3>
<p class="hint">Easy: pressing the right letter always counts, even while mashing. Hard: mashing never advances — he gets coached to press just the one letter.</p>
<div class="cfg-segmented">
<button id="difficulty-easy">😊 Easy</button>
<button id="difficulty-hard">🏆 Hard</button>
</div>
</section>
<section class="cfg-section">
<h3>🗣️ Voice</h3>
<p class="hint">Voices come from this device's text-to-speech, so the choices differ between phone, tablet, and computer.</p>
<select id="voice-select"></select>
<div class="cfg-slider-row">
<label for="speech-rate">Speed</label>
<input id="speech-rate" type="range" min="0.5" max="1.6" step="0.05" />
<span id="speech-rate-value">×1.00</span>
</div>
<div class="cfg-row">
<button type="button" id="voice-preview" class="cfg-btn">▶ Preview voice</button>
</div>
</section>
<section class="cfg-section">
<h3>🎶 Background music</h3>
<p class="hint">Paste a YouTube playlist link (or ID) to use it as background music. Leave empty for the built-in tunes.</p>
<form id="playlist-form">
<input id="playlist-input" type="text" placeholder="https://www.youtube.com/playlist?list=..." />
<div class="cfg-row">
<button type="submit" class="cfg-btn primary">Save playlist</button>
<button type="button" id="playlist-clear" class="cfg-btn">Use built-in tunes</button>
</div>
</form>
<div id="playlist-status" class="hint status"></div>
</section>
<section class="cfg-section">
<h3>🖼️ Custom picture cards</h3>
<p class="hint">Add a photo and the word he should say. Extra accepted words can follow after commas (e.g. “dada, daddy, papa”).</p>
<form id="card-form">
<input id="card-form-word" type="text" placeholder="word (e.g. dada, daddy, papa)" required />
<div class="cfg-row">
<input id="card-form-file" type="file" accept="image/*" />
<button type="button" id="card-camera" class="cfg-btn">📷 Use camera</button>
</div>
<div id="camera-capture" class="hidden">
<video id="capture-video" autoplay playsinline muted></video>
<div class="cfg-row">
<button type="button" id="capture-snap" class="cfg-btn primary">📸 Snap</button>
<button type="button" id="capture-flip" class="cfg-btn">🔄 Flip</button>
<button type="button" id="capture-cancel" class="cfg-btn">Cancel</button>
</div>
</div>
<div id="capture-preview" class="hidden">
<img id="capture-preview-img" alt="captured photo" />
<button type="button" id="capture-retake" class="cfg-btn">↩️ Retake</button>
</div>
<button type="submit" class="cfg-btn primary">Add card</button>
<div id="card-form-status" class="hint status"></div>
</form>
<ul id="custom-card-list"></ul>
</section>
<div id="net-status" class="hint"></div>
<div id="parent-footer">
<a href="https://github.com/ubernaut/hackerbaby" target="_blank" rel="noopener">⭐ hackerbaby on GitHub</a>
<p class="hint">
Found a bug or have an idea for a new game?
<a href="https://github.com/ubernaut/hackerbaby/issues" target="_blank" rel="noopener">File an issue or feature request</a>
— they're very welcome!
</p>
</div>
</div>
</div>
</div>
<div id="start-overlay" class="overlay">
<div id="start-inner">
<div id="start-title">HACKER BABY</div>
<button id="start-button">▶ PLAY</button>
</div>
</div>
<script type="module" src="./src/main.js"></script>
</body>
</html>