X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/3232c47b5c02deecf8391974323073e82f038c33..49ffd5482382cad5c9eae0c73d2d11af5ea81b08:/word/multichoice.js?ds=sidebyside diff --git a/word/multichoice.js b/word/multichoice.js index 5908fdc..7402507 100644 --- a/word/multichoice.js +++ b/word/multichoice.js @@ -1,17 +1,18 @@ -class WordMultiChoice extends WordQuiz { +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[2]}.jpg`, + '+img[src=$]+ul', `/data/word/32/${word[2]}.jpg`, ); let answers = [word[0], this.words[0][0], this.words[1][0], this.words[2][0]] .shuffle() + this.log('ask', word[2], answers); 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]) { // incorrect put(option, '.wrong'); @@ -24,7 +25,7 @@ class WordMultiChoice extends WordQuiz { } setup() { - this.form = document.getElementById('quiz'); + super.setup(); this.next(); } };