keyboard/altgr/index: move ctrl rows to distinct inventory mode
[sheet.git] / word / wijzer.js
index 5f2a3bba9ad40ec5a4253ce6310dd8ec269caefb..7ae3d3ef758216f7c1498f24f165f6bb168c49cb 100644 (file)
@@ -6,13 +6,14 @@ class WordWijzer extends WordQuiz {
                        this.form.querySelectorAll('li[onclick]').forEach(answer => {
                                answer.removeAttribute('onclick');
                        });
+                       this.log('done');
                        return;
                }
 
                this.question.innerHTML = '';
                put(this.question,
-                       '[data-id=$] img[src=$]', word[2],
-                       `/data/word/32/${word[2]}.jpg`
+                       '[data-id=$] img[src=$]', word.id,
+                       word.thumb()
                );
        }
 
@@ -22,20 +23,24 @@ class WordWijzer extends WordQuiz {
                console.log(this.question, answer);
                let match = this.question.dataset.id == answer.dataset.id;
                put(answer, match ? '.good' : '.wrong');
+               this.log('pick', answer.dataset.id, answer.index, this.question.dataset.id);
                this.next();
        }
 
        setup() {
-               this.form = document.getElementById('quiz');
+               super.setup();
+               this.form.innerHTML = '';
                this.question = put(this.form, 'figure');
                this.words.splice(9)
 
                let answers = put(this.form, 'ul');
                this.words
-                       .forEach(answer => {
-                               let label = answer[0].replace(/\/.*/, ''); // primary form
+                       .forEach((answer, seq) => {
                                put(answers, 'li[data-id=$][onclick=""]',
-                                       answer[2], label, {onclick: e => this.verify(e)}
+                                       answer.id, answer.label, {
+                                               onclick: e => this.verify(e),
+                                               index: seq,
+                                       }
                                )
                        });
                this.words.shuffle();