Fix answer clicks broken by missing q param in pick(), fix fetch path for GitHub Pages

This commit is contained in:
justin committed 2026-05-14 09:45:23 -07:00
1 parent a8c82a19b6
commit 9f7a449e3d
1 file changed
+3 -3
+3 -3
View File
@@ -472,7 +472,7 @@ class Game {
/* ── LOAD QUESTIONS ───────────────────────────────────── */
loadQuestions(cb) {
if (this.state.questions.length>0) { cb(); return; }
fetch('questions.json')
fetch('./questions.json')
.then(r=>r.json())
.then(data=>{ this.state.questions=data.levels[0].questions; cb(); })
.catch(()=>this.toast('❌ Could not load questions.json'));
@@ -564,13 +564,13 @@ class Game {
btn.className='choice-btn';
btn.setAttribute('data-letter', slotIdx + 1);
btn.textContent=q.options[origIdx];
btn.addEventListener('click',()=>this.pick(slotIdx, correctShuffledIdx, container));
btn.addEventListener('click',()=>this.pick(slotIdx, correctShuffledIdx, q, container));
container.appendChild(btn);
});
this._renderCursor();
}
pick(chosen, correctIdx, container) {
pick(chosen, correctIdx, q, container) {
if(this.state.answering)return;
this.state.answering=true;