X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/557e9a9b737294f5e170f8f5474ff750ab72cb4a..3232c47b5c02deecf8391974323073e82f038c33:/word/multichoice.js diff --git a/word/multichoice.js b/word/multichoice.js index 649d19a..5908fdc 100644 --- a/word/multichoice.js +++ b/word/multichoice.js @@ -1,16 +1,18 @@ class WordMultiChoice extends WordQuiz { next() { + if (this.words.length < 4) return; let word = this.words.shift(); + if (!word[2]) return this.next(); let form = put(this.form, - '+img[src=$]+ul', `/data/word/en/${word[0]}.jpg`, + '+img[src=$]+ul', `/data/word/en/${word[2]}.jpg`, ); - let answers = [word[2], this.words[0][2], this.words[1][2], this.words[2][2]] + let answers = [word[0], this.words[0][0], this.words[1][0], this.words[2][0]] .shuffle() answers.forEach(suggest => { let label = suggest.replace(/\/.*/, ''); let option = put(form, 'li', label, {onclick: () => { - if (suggest != word[2]) { + if (suggest != word[0]) { // incorrect put(option, '.wrong'); return;