Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
306 lines (290 loc) · 16 KB
/
Copy pathindex.html
File metadata and controls
306 lines (290 loc) · 16 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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="theme-color" content="#0b1020">
<title>GenericBlockGame</title>
<script>
document.documentElement.toggleAttribute("data-native-fullscreen", window.GenericBlockGameHost?.fullscreen === "native");
</script>
<link rel="icon" type="image/svg+xml" href="icon.svg">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<main class="game-shell" aria-label="Hex block puzzle game">
<header class="topbar">
<button id="settingsButton" class="icon-button" type="button" aria-label="Open settings" title="Settings">
<svg aria-hidden="true" viewBox="0 0 24 24">
<path d="M12 15.25a3.25 3.25 0 1 0 0-6.5 3.25 3.25 0 0 0 0 6.5Z"></path>
<path d="M19.4 15a1.7 1.7 0 0 0 .34 1.88l.06.06-2.86 2.86-.06-.06A1.7 1.7 0 0 0 15 19.4a1.7 1.7 0 0 0-1 .6 1.7 1.7 0 0 0-.4 1.1V21h-4v-.1A1.7 1.7 0 0 0 8.6 19.4a1.7 1.7 0 0 0-1.88.34l-.06.06-2.86-2.86.06-.06A1.7 1.7 0 0 0 4.2 15a1.7 1.7 0 0 0-.6-1 1.7 1.7 0 0 0-1.1-.4H2.4v-4h.1A1.7 1.7 0 0 0 4.2 8.6a1.7 1.7 0 0 0-.34-1.88l-.06-.06L6.66 3.8l.06.06A1.7 1.7 0 0 0 8.6 4.2a1.7 1.7 0 0 0 1-.6A1.7 1.7 0 0 0 10 2.5v-.1h4v.1a1.7 1.7 0 0 0 1 1.7 1.7 1.7 0 0 0 1.88-.34l.06-.06 2.86 2.86-.06.06A1.7 1.7 0 0 0 19.4 8.6a1.7 1.7 0 0 0 .6 1 1.7 1.7 0 0 0 1.1.4h.1v4h-.1a1.7 1.7 0 0 0-1.7 1Z"></path>
</svg>
</button>
<p id="saveStatus" class="save-status" role="status" hidden>Progress is not saved. Keep this page open.</p>
<button id="resetButton" class="icon-button" type="button" aria-label="Restart game" title="Restart game">
<svg aria-hidden="true" viewBox="0 0 24 24">
<path d="M4 4v6h6"></path>
<path d="M5.5 15.5A8 8 0 1 0 6 7.5L4 10"></path>
</svg>
</button>
</header>
<section class="score-panel" aria-label="Score">
<div id="soloScore">
<span class="score-label">Score</span>
<span id="timerDisplay" class="timer-display" hidden>3:00</span>
<strong id="score" class="score">0</strong>
</div>
<div id="bestScorePanel" class="best-score">
<span id="bestScoreLabel" class="score-label">Best score</span>
<strong id="bestScore">0</strong>
</div>
<div id="matchScoreboard" class="match-scoreboard" hidden aria-live="polite">
<div id="redPlayer" class="player-score red-player">
<span class="score-label">Red</span>
<strong id="redScore" class="score">0</strong>
</div>
<div id="bluePlayer" class="player-score blue-player">
<span class="score-label">Blue</span>
<strong id="blueScore" class="score">0</strong>
</div>
<p id="turnStatus" class="turn-status"></p>
</div>
</section>
<section class="board-wrap">
<div id="board" class="board" role="grid" aria-label="Hexagon game board"></div>
<div id="scoreBurst" class="score-burst" aria-hidden="true"></div>
</section>
<section class="tray-section" aria-label="Piece tray">
<div class="tray-carousel">
<button id="trayPreviousButton" class="tray-arrow" type="button" aria-label="Shift tray left one piece" aria-controls="tray" hidden>
<svg aria-hidden="true" viewBox="0 0 24 32"><path d="M17 5 6 16 17 27"></path></svg>
</button>
<div class="tray-viewport">
<div id="tray" class="tray"></div>
</div>
<button id="trayNextButton" class="tray-arrow" type="button" aria-label="Shift tray right one piece" aria-controls="tray" hidden>
<svg aria-hidden="true" viewBox="0 0 24 32"><path d="M7 5 18 16 7 27"></path></svg>
</button>
</div>
<div class="tray-actions">
<button id="undoButton" class="undo-button" type="button" disabled>
<span aria-hidden="true">↶</span> Undo
</button>
<button id="passButton" class="undo-button pass-button" type="button" hidden>Pass</button>
<button id="continueButton" class="undo-button" type="button" hidden>Continue</button>
</div>
</section>
</main>
<div id="dragLayer" class="drag-layer" aria-hidden="true"></div>
<section id="settingsPanel" class="settings-panel" aria-hidden="true" aria-labelledby="settingsTitle">
<div class="settings-card">
<header class="settings-header">
<h2 id="settingsTitle">Settings</h2>
<button id="settingsCloseButton" class="settings-close" type="button" aria-label="Close settings">×</button>
</header>
<div class="settings-content">
<div class="settings-content-inner">
<div id="boardTypeSetting" class="segmented-control board-mode-tabs" role="tablist" aria-label="Board type">
<span class="segmented-indicator" aria-hidden="true"></span>
<button id="hexSettingsTab" type="button" data-board-mode="hex" role="tab" aria-controls="boardSettingsContent" aria-selected="true">Hex</button>
<button id="squareSettingsTab" type="button" data-board-mode="square" role="tab" aria-controls="boardSettingsContent" aria-selected="false">Square</button>
</div>
<div id="boardSettingsContent" role="tabpanel" aria-labelledby="hexSettingsTab">
<section class="settings-section">
<h3 class="general-heading">General</h3>
<div id="gameModeSetting" class="segmented-control mode-segmented-control" role="radiogroup" aria-label="Game mode">
<span class="segmented-indicator" aria-hidden="true"></span>
<button type="button" data-mode="unlimited" role="radio">Unlimited</button>
<button type="button" data-mode="timed" role="radio">Time Trial</button>
<button type="button" data-mode="two-player" role="radio">2 Player</button>
<button type="button" data-mode="ai" role="radio">VS AI</button>
</div>
<label class="setting-toggle">
<span>Show undo button</span>
<input id="undoSetting" type="checkbox">
</label>
<div class="drag-settings">
<div id="aiDifficultyRow" class="board-size-setting" hidden>
<span>AI difficulty</span>
<div id="aiDifficultySetting" class="segmented-control" role="radiogroup" aria-label="AI difficulty">
<span class="segmented-indicator" aria-hidden="true"></span>
<button type="button" data-difficulty="easy" role="radio">Easy</button>
<button type="button" data-difficulty="medium" role="radio">Medium</button>
<button type="button" data-difficulty="hard" role="radio">Hard</button>
</div>
</div>
<label id="timeTrialDurationRow">
<span>Time trial limit</span>
<span class="number-stepper">
<button type="button" data-step-target="timeTrialDurationSetting" data-step="-30" aria-label="Decrease time limit">−</button>
<input id="timeTrialDurationSetting" type="number" min="30" max="600" step="30">
<button type="button" data-step-target="timeTrialDurationSetting" data-step="30" aria-label="Increase time limit">+</button>
</span>
</label>
<label>
<span>Tray size</span>
<span class="number-stepper">
<button type="button" data-step-target="traySizeSetting" data-step="-1" aria-label="Decrease tray size">−</button>
<input id="traySizeSetting" type="number" min="1" max="8" step="1">
<button type="button" data-step-target="traySizeSetting" data-step="1" aria-label="Increase tray size">+</button>
</span>
</label>
<div class="board-size-setting">
<span id="boardSizeLabel">Cells per edge</span>
<div id="boardSizeSetting" class="segmented-control" role="radiogroup" aria-label="Cells per edge">
<span class="segmented-indicator" aria-hidden="true"></span>
<button type="button" data-size="4" role="radio">4</button>
<button type="button" data-size="5" role="radio">5</button>
<button type="button" data-size="6" role="radio">6</button>
</div>
</div>
<label>
<span>Snap safety margin</span>
<span class="number-stepper multiplier-stepper">
<button type="button" data-step-target="snapOverlapSetting" data-step="-0.1" aria-label="Decrease snap safety margin">−</button>
<input id="snapOverlapSetting" type="number" min="1" max="3" step="0.1">
<button type="button" data-step-target="snapOverlapSetting" data-step="0.1" aria-label="Increase snap safety margin">+</button>
</span>
</label>
</div>
</section>
<section class="settings-section">
<div class="settings-section-heading">
<div>
<h3>Pieces</h3>
<p>Enable pieces and change how often they appear.</p>
</div>
</div>
<div id="pieceSettingsList" class="piece-settings-list"></div>
</section>
<section class="settings-section">
<h3>Create a piece</h3>
<p id="pieceEditorHint">Select hex cells to make a piece.</p>
<div id="shapeEditor" class="shape-editor" aria-label="Custom piece editor"></div>
<div class="designer-fields">
<label>
Name
<input id="customPieceName" type="text" maxlength="24" placeholder="My piece">
</label>
<label>
Frequency
<input id="customPieceWeight" type="number" min="1" max="100" value="5">
</label>
</div>
<div id="designerMessage" class="designer-message" aria-live="polite"></div>
<div class="designer-actions">
<button id="clearDesignerButton" class="settings-action" type="button">Clear</button>
<button id="saveCustomPieceButton" class="settings-action primary-setting-action" type="button">Add piece</button>
</div>
</section>
</div>
<section class="settings-section">
<h3>Accessibility</h3>
<p>Applies to Hex and Square.</p>
<label class="setting-toggle">
<span>Slow mode</span>
<input id="slowModeSetting" type="checkbox" aria-describedby="slowModeHint">
</label>
<p id="slowModeHint">Wait for Continue after the last piece so you can still undo.</p>
<div class="drag-settings accessibility-settings">
<label>
<span>Pickup offset</span>
<span class="number-stepper">
<button type="button" data-step-target="dragInitialOffsetSetting" data-step="-5" aria-label="Decrease initial drag offset">−</button>
<input id="dragInitialOffsetSetting" type="number" min="0" max="300" step="5">
<button type="button" data-step-target="dragInitialOffsetSetting" data-step="5" aria-label="Increase initial drag offset">+</button>
</span>
</label>
<label>
<span>Vertical drag offset</span>
<span class="number-stepper">
<button type="button" data-step-target="dragMovingOffsetSetting" data-step="-5" aria-label="Decrease vertical drag offset">−</button>
<input id="dragMovingOffsetSetting" type="number" min="0" max="400" step="5">
<button type="button" data-step-target="dragMovingOffsetSetting" data-step="5" aria-label="Increase vertical drag offset">+</button>
</span>
</label>
<label>
<span>Horizontal drag offset</span>
<span class="number-stepper">
<button type="button" data-step-target="dragHorizontalOffsetSetting" data-step="-5" aria-label="Decrease horizontal drag offset">−</button>
<input id="dragHorizontalOffsetSetting" type="number" min="0" max="400" step="5">
<button type="button" data-step-target="dragHorizontalOffsetSetting" data-step="5" aria-label="Increase horizontal drag offset">+</button>
</span>
</label>
<label class="hue-setting">
<span>Piece hue (single player)</span>
<span class="hue-control">
<input id="pieceHueSetting" type="range" min="0" max="359" step="1" aria-label="Piece color hue">
<output id="pieceHueValue" for="pieceHueSetting">212°</output>
</span>
</label>
</div>
</section>
<section class="settings-section reset-settings-section">
<h3>Reset</h3>
<p>Applies to Hex and Square.</p>
<div class="reset-actions">
<button id="resetBestButton" class="settings-action danger-action" type="button">Reset top score</button>
<button id="resetSettingsButton" class="settings-action danger-action" type="button">Reset all settings</button>
</div>
<div id="resetConfirmation" class="reset-confirmation" hidden>
<p id="resetConfirmationText"></p>
<div>
<button id="cancelResetButton" class="settings-action" type="button">Cancel</button>
<button id="confirmResetButton" class="settings-action danger-action" type="button">Confirm reset</button>
</div>
</div>
</section>
<footer class="settings-footer">
GenericBlockGame | Created by Goodgui | <a href="https://github.com/Goodgui" target="_blank" rel="noopener noreferrer">View on Github</a> | <button id="appVersion" type="button" aria-label="View change log" aria-haspopup="dialog" aria-controls="changelogModal"></button>
</footer>
</div>
</div>
</div>
</section>
<button id="fullscreenButton" class="fullscreen-button" type="button" aria-label="Enter fullscreen" title="Enter fullscreen">
<svg class="fullscreen-enter" aria-hidden="true" viewBox="0 0 24 24">
<path d="M8 3H3v5M16 3h5v5M8 21H3v-5M16 21h5v-5"></path>
</svg>
<svg class="fullscreen-exit" aria-hidden="true" viewBox="0 0 24 24">
<path d="M3 8h5V3M21 8h-5V3M3 16h5v5M21 16h-5v5"></path>
</svg>
</button>
<div id="modal" class="modal is-open" role="dialog" aria-modal="true" aria-labelledby="modalTitle">
<div class="modal-card">
<h1 id="modalTitle">GenericBlockGame</h1>
<p id="modalText">Fit hex pieces. Clear full lines in three directions or an outlined seven-hex group. Edge cells outside the groups clear through lines.</p>
<strong id="modalScore" class="modal-score" hidden>0</strong>
<div class="modal-actions">
<button id="modalCancelButton" class="modal-undo-button" type="button" hidden>Cancel</button>
<button id="modalUndoButton" class="modal-undo-button" type="button" hidden>↶ Undo</button>
<button id="modalButton" class="primary-button" type="button">Start game</button>
</div>
</div>
</div>
<div id="changelogModal" class="modal changelog-modal" role="dialog" aria-modal="true" aria-labelledby="changelogTitle">
<div class="modal-card">
<h1 id="changelogTitle">What's new</h1>
<p id="changelogVersion"></p>
<ul id="changelogList" class="changelog-list"></ul>
<div class="modal-actions">
<button id="changelogButton" class="primary-button" type="button">Got it</button>
</div>
</div>
</div>
<!-- Ordered classic scripts also work when this file is opened with file://. -->
<script src="config.js"></script>
<script src="hex.js"></script>
<script src="preferences.js"></script>
<script src="shapes.js"></script>
<script src="board.js"></script>
<script src="scoring.js"></script>
<script src="two-player.js"></script>
<script src="ai.js"></script>
<script src="storage.js"></script>
<script src="profile.js"></script>
<script src="ui.js"></script>
<script src="settings.js"></script>
<script src="game.js"></script>
</body>
</html>