word: change directory name of 3:2 thumbnails
[sheet.git] / word / memory.js
index 94836c282b54666093c396631cc56fe17c8840db..a6b19061fee1e42dbbc6f9df3e7ffc94c80e1f8d 100644 (file)
@@ -58,7 +58,11 @@ class WordMemory extends WordQuiz {
 
                let cards;
                if (this.words) {
-                       cards = this.words.splice(0, 6).map(row => row[2]);
+                       const formstyle = window.getComputedStyle(this.form)
+                       const gridsize = [
+                               formstyle['grid-template-rows'], formstyle['grid-template-columns']
+                       ].map(val => val.match(/ /g).length + 1).reduce((x, y) => x * y) / 2;
+                       cards = this.words.splice(0, gridsize || 6).map(row => row[2]);
                        cards.push(...cards.map(val => -val));
                }
                else {
@@ -69,7 +73,7 @@ class WordMemory extends WordQuiz {
                cards.shuffle().forEach(word => {
                        let ref = Math.abs(word);
                        put(this.form,
-                               'figure>img[src=$]<', `/data/word/en/${ref}.jpg`,
+                               'figure>img[src=$]<', `/data/word/32/${ref}.jpg`,
                                {onclick: e => this.turn(e), id: ref, className: word < 0 ? 'mirror' : ''}
                        );
                });