1 class WordMultiChoice extends WordQuiz {
3 if (this.words.length < 4) return;
4 let word = this.words.shift();
5 if (!word[2]) return this.next();
6 let form = put(this.form,
7 '+img[src=$]+ul', `/data/word/32/${word[2]}.jpg`,
10 let answers = [word[0], this.words[0][0], this.words[1][0], this.words[2][0]]
12 this.log('ask', word[2], answers);
13 answers.forEach(suggest => {
14 let label = suggest.replace(/\/.*/, '');
15 let option = put(form, 'li', label, {onclick: () => {
16 this.log('pick', suggest, null, word[0]);
17 if (suggest != word[0]) {
19 put(option, '.wrong');
23 window.setTimeout(() => this.next(), 500);
29 this.form = document.getElementById('quiz');