-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.html
288 lines (268 loc) · 10.4 KB
/
main.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
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
---
title: "Spelling Bee"
date: 2020-06-14T02:52:22-04:00
slug: "spelling-bee"
type: "standalone"
tags: ["project"]
forward: ""
summary: "A homegrown version of the entertaining New York Times puzzle."
draft: false
---
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="shortcut icon" type="image/png" href="img/favicon.png" />
<title>Spelling Bee</title>
<link rel="stylesheet" href="styles.css?5" />
</head>
<body>
<script src="libs/papaparse.js"></script>
<script src="libs/alea.min.js"></script>
<script src="js/words.js?5"></script>
<script src="js/interface.js?5"></script>
<script src="js/main.js?5"></script>
<header id="header">
<div>
<h1>Spelling Bee</h1>
<h2>
<a href="#" onclick="showAboutPopup();return false;">about</a> |
<a href="#" onclick="showPrevPopup();return false;">prev</a> |
<a href="#" onclick="showResetPopup();return false;">reset</a> |
<a id="toggle-dark" href="#" onclick="toggleDarkMode();return false;">dark</a>
</h2>
</div>
</header>
<div id="container" class="container">
<div id="date-container"></div>
<div id="progress-container" onclick="showProgressPopup()">
<div id="progress-info">
<div id="progress-name">Beginner</div>
<div id="progress-next"></div>
</div>
<div id="progress-bar">
<div id="progress-dots">
<div class="progress-dot">
<span class="progress-incomplete"></span>
</div>
<div class="progress-dot">
<span class="progress-incomplete"></span>
</div>
<div class="progress-dot">
<span class="progress-incomplete"></span>
</div>
<div class="progress-dot">
<span class="progress-incomplete"></span>
</div>
<div class="progress-dot">
<span class="progress-incomplete"></span>
</div>
<div class="progress-dot">
<span class="progress-incomplete"></span>
</div>
<div class="progress-dot">
<span class="progress-incomplete"></span>
</div>
<div class="progress-dot">
<span class="progress-incomplete"></span>
</div>
<div class="progress-dot">
<span class="progress-incomplete progress-square"></span>
</div>
</div>
<div id="progress-current" class="progress-complete">
<div id="progress-current-score">0</div>
</div>
</div>
</div>
<div id="entered-container" class="entered-container">
<div id="entered-words" class="entered-words"></div>
<span id="entered-toggle"></span>
</div>
<div id="below-entered-container" class="below-entered-container">
<div id="message-container">
<div id="message">.</div>
</div>
<div id="entry-container">
<div id="entry-container-holder"></div>
</div>
<div id="keys-container">
<div class="keys-spacer"></div>
<div class="keys-letter">
<button id="keys-1" type="button" class="keys-button"></button>
</div>
<div class="keys-letter">
<button id="keys-2" type="button" class="keys-button"></button>
</div>
<div class="keys-letter">
<button id="keys-3" type="button" class="keys-button"></button>
</div>
<div class="keys-letter">
<button id="keys-middle" type="button" class="keys-button keys-button-middle"></button>
</div>
<div class="keys-letter">
<button id="keys-4" type="button" class="keys-button"></button>
</div>
<div class="keys-spacer"></div>
<div class="keys-letter">
<button id="keys-5" type="button" class="keys-button"></button>
</div>
<div class="keys-letter">
<button id="keys-6" type="button" class="keys-button"></button>
</div>
</div>
<div id="buttons-container">
<button id="button-delete" type="button" class="nav-button">
Delete
</button>
<div id="button-shuffle-container">
<button id="button-shuffle" type="button" class="nav-button"></button>
<div id="button-shuffle-img"></div>
</div>
<button id="button-enter" type="button" class="nav-button">
Enter
</button>
</div>
</div>
</div>
<div id="popup-click-bg" class="hidden"></div>
<div id="progress-popup" class="popup hidden">
<div class="popup-content">
<div class="popup-heading">Rankings</div>
<div class="popup-content-text">
<p>The points required for each rank are fixed percentages of the maximum number of points for each puzzle.</p>
<p>Today's puzzle:</p>
<p>
<ul id="progress-popup-ranking"></ul>
</p>
</div>
</div>
<span id="popup-exit" onclick="hideProgressPopup()"></span>
</div>
<div id="about-popup" class="popup hidden">
<div class="popup-content">
<div class="popup-heading">About</div>
<div class="popup-content-text">
<p>Create words using the letters shown.
<ul>
<li>Words must have at least four letters.</li>
<li>Words must include the center letter.</li>
<li>Letters can be used more than once.</li>
<li>
Words with hyphens, proper nouns, vulgarities, and especially
obscure words are not in the word list<b id="popup-content-text-hmm"></b>.
</li>
</ul>
</p>
<p>Every word earns points.
<ul>
<li>Four-letter words are worth 1 point.</li>
<li>Five-letter words and longer are worth 1 point for each letter.</li>
<li>Pangrams — words that use all seven letters — earn an additional bonus of 7 points. There is at least
one
pangram per puzzle.<b id="explanation-hmm"></b></li>
</ul>
</p>
<p>
New puzzles generate at midnight.
</p>
<p>
<span id="name-hmm">Spelling Bee was made by <a href="https://jamescalixto.com/" target="_blank">James
Calixto</a></span>, inspired by the
<a href="https://www.nytimes.com/puzzles/spelling-bee" target="_blank">New York Times puzzle</a>. Check out
the source on <a href="https://github.com/jamescalixto/spelling-bee" target="_blank">GitHub</a>.
</p>
<p>
Word lists are from <a href="http://wordlist.aspell.net/" target="_blank">SCOWL</a>,
with minor changes and filtering. SCOWL copyright and licensing information can be found
<a href="http://wordlist.aspell.net/scowl-readme/" target="_blank">here</a>.
</p>
</div>
</div>
<span id="popup-exit" onclick="hideAboutPopup()"></span>
</div>
<div id="prev-popup" class="popup hidden">
<div class="popup-content">
<div class="popup-heading">Yesterday's answers</div>
<div class="popup-content-text">
<div id="prev-letters-container"></div>
<div id="prev-stats">
<span id="prev-stats-words-found"></span><span id="prev-stats-words"></span> words | <span
id="prev-stats-points-found"></span><span id="prev-stats-points"></span> points</div>
<div id="prev-words-container"></div>
</div>
<p class="popup-content-text">
The highlighted letter indicates the required letter. Highlighted words indicate pangrams. <span
id="popup-content-text-entered" class="hidden">Bolded words indicate the words you found.</span>
</p>
<p class="popup-content-text">
Click on the words to see their definitions in Merriam-Webster.
</p>
</div>
<span id="popup-exit" onclick="hidePrevPopup()"></span>
</div>
<div id="reset-popup" class="popup hidden">
<div id="popup-content-alt">
<h1>Reset</h1>
<p id="reset-text">Are you sure you want to clear your progress?</p>
<button id="button-no-reset" type="button" class="reset-button" onclick="hideResetPopup()">
No thanks
</button>
<button id="button-reset" type="button" class="reset-button reset-button-action" onclick="resetGame()">
Reset
</button>
</div>
<span id="popup-exit-alt" onclick="hideResetPopup()"></span>
</div>
<div id="return-popup" class="popup hidden">
<div id="popup-content-alt">
<h1 class="return-popup-header">Welcome back!</h1>
<p id="return-text">You've achieved the rank of <b id="return-rank"></b> by finding <b
id="return-words"></b> for
<b id="return-points"></b>.</p>
<p id="return-countdown">How far can you get in the next <b id="return-countdown-span">day</b>?</p>
</div>
<span id="popup-exit-alt" onclick="hideReturnPopup()"></span>
</div>
<div id="victory-popup" class="popup hidden">
<div id="popup-content-alt">
<img id="victory-img" src="img/victory.svg">
<h1>Excellent work!</h1>
<p id="victory-text">You've reached the highest rank, with <b id="victory-words"></b> and <b
id="victory-points"></b>.</p>
<p id="victory-countdown">Check back in <b id="victory-countdown-span">a bit</b> for a new puzzle.</p>
</div>
<span id="popup-exit-alt" onclick="hideVictoryPopup()"></span>
</div>
<div id="all-popup" class="popup hidden">
<div id="popup-content-alt">
<img id="all-img" src="img/fireworks.svg">
<h1>Spectacular!</h1>
<p id="all-text">You've found all <b id="all-words"></b>, worth <b id="all-points"></b>. Truly
incredible.
</p>
<p id="all-countdown">Check back in <b id="all-countdown-span">a bit</b> for a new puzzle.</p>
</div>
<span id="popup-exit-alt" onclick="hideAllPopup()"></span>
</div>
<script>
getDarkCookie();
var returnPopupNotShownYet = true;
// Prevent backspace from navigating page.
window.onkeydown = function (e) {
if (e.keyCode == 8 && e.target == document.body)
e.preventDefault();
}
setUpKeyboardInput();
setUpButtonFunctions();
Papa.parse("data/words.csv?3", {
download: true,
complete: function (result) {
let data = result.data.flat(); // unpack result array.
newGame(data);
},
});
</script>
</body>
</html>