X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/dbdf824e31eb22e5f5689c9bfc060b52433e8415..fa43237a3eb6cc3f399fd3b2584ef6152a07dc1e:/word/multichoice.js diff --git a/word/multichoice.js b/word/multichoice.js index 7402507..300a32f 100644 --- a/word/multichoice.js +++ b/word/multichoice.js @@ -3,17 +3,16 @@ class WordMultichoice extends WordQuiz { if (this.words.length < 4) return; let word = this.words.shift(); let form = put(this.form, - '+img[src=$]+ul', `/data/word/32/${word[2]}.jpg`, + '+img[src=$]+ul', word.thumb() ); - let answers = [word[0], this.words[0][0], this.words[1][0], this.words[2][0]] + let answers = [word, this.words[0], this.words[1], this.words[2]] .shuffle() - this.log('ask', word[2], answers); + this.log('ask', word.id, answers.map(w => w.id)); answers.forEach(suggest => { - let label = suggest.replace(/\/.*/, ''); - let option = put(form, 'li', label, {onclick: () => { - this.log('pick', suggest, null, word[0]); - if (suggest != word[0]) { + let option = put(form, 'li', suggest.label, {onclick: () => { + this.log('pick', suggest.id, null, word.id); + if (suggest.label != word.label) { // incorrect put(option, '.wrong'); return;