- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrossword.html
More file actions
Latest commit
288 lines (259 loc) · 10.8 KB
/
Copy pathcrossword.html
File metadata and controls
288 lines (259 loc) · 10.8 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
<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="utf-8" />
<metaname="viewport" content="width=device-width,initial-scale=1" />
<title>Crossword - MathEXplained</title>
<metaname="description" content="Play the official MathEXplained crossword. Every monthly puzzle, with solutions." />
<linkrel="icon" href="assets/favicon.ico" type="image/x-icon">
<linkrel="preconnect" href="https://fonts.googleapis.com">
<linkrel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<linkrel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400..700&family=Inter:wght@400..700&display=swap">
<linkrel="stylesheet" href="./style.css">
<linkrel="stylesheet" href="https://unpkg.com">
<!-- Pre-rendered SVG for the decorative background; no MathJax runtime needed. -->
<scriptsrc="math-symbols.js" defer></script>
<scriptsrc="background.js" defer></script>
<scriptsrc="site.js" defer></script>
</head>
<bodyclass="crossword-page with-header-gap">
<!-- icons:start (generated by tools/build-icons.mjs) -->
<svgxmlns="http://www.w3.org/2000/svg" hiddenaria-hidden="true">
<symbolid="i-search" viewBox="0 0 24 24"><pathd="m21 21-4.34-4.34" /><circlecx="11" cy="11" r="8" /></symbol>
<symbolid="i-x" viewBox="0 0 24 24"><pathd="M18 6 6 18" /><pathd="m6 6 12 12" /></symbol>
<symbolid="i-arrow-up" viewBox="0 0 24 24"><pathd="m5 12 7-7 7 7" /><pathd="M12 19V5" /></symbol>
<symbolid="i-arrow-left" viewBox="0 0 24 24"><pathd="m12 19-7-7 7-7" /><pathd="M19 12H5" /></symbol>
</svg>
<!-- icons:end -->
<aclass="skip-link" href="#main">Skip to content</a>
<canvasid="proximity-grid" aria-hidden="true"></canvas>
<divclass="math-bg-layer" aria-hidden="true"></div>
<divclass="announcement-banner">📣 Join our Google Group for exclusive email updates! <ahref="https://groups.google.com/g/mathexplained-magazine-releases" target="_blank">Learn more...</a></div>
<headerclass="headerbar">
<aclass="brand" href="index.html">
<imgsrc="assets/logo.webp" width="48" height="48">
<spanclass="site-title">Math<spanclass="accent">EX</span>plained</span>
</a>
<navclass="nav-right" aria-label="Primary">
<ahref="index.html">Past Releases</a>
<ahref="about_us.html">About Us</a>
<ahref="staff.html">Staff</a>
<ahref="crossword.html">Crossword</a>
<ahref="apply.html" class="nav-cta">APPLY!</a>
<ahref="https://discord.com/invite/Fnhwbzfpfz" target="_blank" class="navlink">
<imgsrc="https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/discord.svg" alt="Join us on Discord" class="discord-icon">
</a>
<ahref="https://www.instagram.com/mathexplainedmagazine" target="_blank" class="navlink">
<imgsrc="https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/instagram.svg" alt="Follow us on Instagram" class="instagram-icon">
</a>
</nav>
</header>
<mainclass="container crossword-container" id="main" role="main">
<h1>MathEXplained Official Crossword Player</h1>
<!-- Top controls row: select left-ish, buttons right -->
<divclass="cw-top-controls">
<divclass="cw-select-wrap">
<labelfor="problemSelect" class="sr-only">Select problem set:</label>
<selectid="problemSelect" aria-label="Select problem set"></select>
</div>
<divclass="cw-btn-group">
<buttonid="checkBtn" type="button" class="cw-btn cw-btn-check">Check</button>
<buttonid="clearBtn" type="button" class="cw-btn cw-btn-clear">Clear</button>
<buttonid="giveUpBtn" type="button" class="cw-btn cw-btn-giveup">Give Up</button>
</div>
</div>
<!-- Main two-panel layout -->
<divclass="cw-main-layout">
<!-- LEFT: Problem PDF viewer -->
<divclass="cw-pdf-panel">
<divclass="cw-pdf-label">Problems</div>
<iframe
id="problemPdfFrame"
class="cw-pdf-iframe"
title="Problem PDF"
aria-label="Problem PDF viewer"
></iframe>
</div>
<!-- RIGHT: Interactive crossword grid -->
<divclass="cw-grid-panel">
<divclass="grid" aria-label="2x2 crossword grid">
<divclass="cell">
<spanclass="cell-number">1.</span>
<inputid="c0" inputmode="text" autocomplete="off" aria-label="cell 1">
</div>
<divclass="cell">
<spanclass="cell-number">2.</span>
<inputid="c1" inputmode="text" autocomplete="off" aria-label="cell 2">
</div>
<divclass="cell">
<spanclass="cell-number">3.</span>
<inputid="c2" inputmode="text" autocomplete="off" aria-label="cell 3">
</div>
<divclass="cell">
<inputid="c3" inputmode="text" autocomplete="off" aria-label="cell 4">
</div>
</div>
</div>
</div><!-- /.cw-main-layout -->
<!-- Status text -->
<divclass="status" id="statusText" aria-live="polite"></div>
<!-- Solution PDF viewer — shown on win OR give up -->
<divid="solutionBox" class="cw-solution-panel" role="region" aria-label="Solutions" style="display:none;">
<divclass="cw-pdf-label">Solutions</div>
<iframe
id="solutionPdfFrame"
class="cw-pdf-iframe cw-solution-iframe"
title="Solution PDF"
aria-label="Solution PDF viewer"
></iframe>
</div>
</main>
<footer>
<divclass="footer-top">
<divclass="footer-brand">
<imgsrc="assets/logo.webp" width="48" height="48">
<divclass="site-title">Math<spanclass="accent">EX</span>plained</div>
<pclass="footer-tagline">A student-run magazine making mathematics readable —
one monthly issue at a time.</p>
</div>
<divclass="footer-links">
<divclass="footer-col">
<h4>Explore</h4>
<ul>
<li><ahref="index.html">Past Releases</a></li>
<li><ahref="crossword.html">Crossword</a></li>
<li><ahref="about_us.html">About Us</a></li>
<li><ahref="staff.html">Staff</a></li>
</ul>
</div>
<divclass="footer-col">
<h4>Get involved</h4>
<ul>
<li><ahref="apply.html">Apply to join</a></li>
<li><ahref="https://groups.google.com/g/mathexplained-magazine-releases"
target="_blank" rel="noopener">Mailing list</a></li>
<li><ahref="https://discord.com/invite/Fnhwbzfpfz"
target="_blank" rel="noopener">Discord</a></li>
<li><ahref="https://www.instagram.com/mathexplainedmagazine"
target="_blank" rel="noopener">Instagram</a></li>
</ul>
</div>
</div>
</div>
<p>© 2026 MathEXplained. All rights reserved.</p>
</footer>
<scriptsrc="crossword_data.js"></script>
<script>
(function(){
letcurrent=0;
letPATH="assets/crossword_pdfs/";
constproblemSelect=document.getElementById('problemSelect');
constproblemPdfFrame=document.getElementById('problemPdfFrame');
constsolutionPdfFrame=document.getElementById('solutionPdfFrame');
conststatusText=document.getElementById('statusText');
constsolutionBox=document.getElementById('solutionBox');
constinputs=[0,1,2,3].map(i=>document.getElementById('c'+i));
constcheckBtn=document.getElementById('checkBtn');
constclearBtn=document.getElementById('clearBtn');
constgiveUpBtn=document.getElementById('giveUpBtn');
/* ── Populate select ── */
functionpopulateSelect(){
crosswordData.forEach(function(entry,idx){
varo=document.createElement('option');
o.value=idx;
o.textContent=entry.name;
if(entry.disabled){
o.disabled=true;
}
problemSelect.appendChild(o);
});
}
/* ── Load PDFs for selected month ── */
functionloadEntry(){
varentry=crosswordData[current];
problemPdfFrame.src=PATH+entry.problemPdf;
clearGrid();
}
/* ── Clear grid + hide solution ── */
functionclearGrid(){
inputs.forEach(function(inp){inp.value='';});
statusText.textContent='';
solutionBox.style.display='none';
solutionPdfFrame.src='';
}
/* ── Show solution PDF ── */
functionshowSolution(){
varentry=crosswordData[current];
solutionPdfFrame.src=PATH+entry.solutionPdf;
solutionBox.style.display='block';
solutionBox.scrollIntoView({behavior: 'smooth',block: 'start'});
}
/* ── Check answers ── */
functioncheckWin(){
varentry=crosswordData[current];
varallFilled=true;
varallCorrect=true;
for(vari=0;i<4;i++){
varuser=(inputs[i].value||'').trim();
if(user==='')allFilled=false;
if(user!==entry.answer[i])allCorrect=false;
}
if(allCorrect&&allFilled){
statusText.textContent='🎉 You win!';
showSolution();
}else{
statusText.textContent='🚫 Incorrect — keep going!';
solutionBox.style.display='none';
}
}
/* ── Give Up ── */
functiongiveUp(){
statusText.textContent='😔 Better luck next time!';
showSolution();
}
/* ── Input behaviour ── */
inputs.forEach(function(inp,i){
inp.setAttribute('maxlength','1');
inp.addEventListener('input',function(e){
varcleaned=(e.target.value||'').toUpperCase().replace(/[^A-Z0-9]/g,'').slice(0,1);
e.target.value=cleaned;
if(cleaned){
inputs[(i+1)%inputs.length].focus();
}
});
inp.addEventListener('keydown',function(e){
if(e.key==='Enter'){
e.preventDefault();
checkWin();
}elseif(e.key==='ArrowRight'){
e.preventDefault();
inputs[(i+1)%inputs.length].focus();
}elseif(e.key==='ArrowLeft'){
e.preventDefault();
inputs[(i-1+inputs.length)%inputs.length].focus();
}elseif(e.key==='ArrowDown'){
e.preventDefault();
inputs[[2,3,0,1][i]].focus();
}elseif(e.key==='ArrowUp'){
e.preventDefault();
inputs[[2,3,0,1][i]].focus();
}
});
});
/* ── Wire buttons ── */
problemSelect.addEventListener('change',function(){
current=Number(problemSelect.value);
loadEntry();
});
checkBtn.addEventListener('click',checkWin);
clearBtn.addEventListener('click',clearGrid);
giveUpBtn.addEventListener('click',giveUp);
/* ── Init ── */
populateSelect();
problemSelect.value=0;
loadEntry();
})();
</script>
</body>
</html>