Fix CONFIRM button broken due to confirmBtn referenced before declaration
This commit is contained in:
1 parent
9966dc65e4
commit
13d33f4688
1 file changed
+11
-7
@@ -1113,6 +1113,17 @@ class Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const selectedSlots = new Set();
|
const selectedSlots = new Set();
|
||||||
|
let confirmBtn = null;
|
||||||
|
|
||||||
|
if (isMulti) {
|
||||||
|
confirmBtn = document.createElement('button');
|
||||||
|
confirmBtn.className='choice-btn confirm-btn confirm-inactive';
|
||||||
|
confirmBtn.textContent='✔ CONFIRM';
|
||||||
|
confirmBtn.addEventListener('click', () => {
|
||||||
|
if (this.state.answering || selectedSlots.size !== 2) return;
|
||||||
|
this.pickMulti(selectedSlots, correctShuffledSet, q, container);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
indices.forEach((origIdx, slotIdx) => {
|
indices.forEach((origIdx, slotIdx) => {
|
||||||
const btn=document.createElement('button');
|
const btn=document.createElement('button');
|
||||||
@@ -1140,13 +1151,6 @@ class Game {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (isMulti) {
|
if (isMulti) {
|
||||||
const confirmBtn = document.createElement('button');
|
|
||||||
confirmBtn.className='choice-btn confirm-btn confirm-inactive';
|
|
||||||
confirmBtn.textContent='✔ CONFIRM';
|
|
||||||
confirmBtn.addEventListener('click', () => {
|
|
||||||
if (this.state.answering || selectedSlots.size !== 2) return;
|
|
||||||
this.pickMulti(selectedSlots, correctShuffledSet, q, container);
|
|
||||||
});
|
|
||||||
container.appendChild(confirmBtn);
|
container.appendChild(confirmBtn);
|
||||||
container._confirmBtn = confirmBtn;
|
container._confirmBtn = confirmBtn;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user