X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/77f6393c7675e2db18438c9f7c4075552ba278b6..ebbfbfbb295d4268eba729b0cee0b85679a04e3f:/word/memory.js diff --git a/word/memory.js b/word/memory.js index ac1e829..99e76e8 100644 --- a/word/memory.js +++ b/word/memory.js @@ -41,17 +41,17 @@ class WordMemory extends WordQuiz { .forEach(card => put(card, '!.turn!.bad')); } - load(dataurl) { - if (dataurl) { - super.load(dataurl); - } - else { + load() { + if (this.preset.pairs) { this.dataurl = '/data/wordpairs.json'; fetch(this.dataurl).then(res => res.json()).then(pairs => { this.pairs = pairs; this.setup(); }); } + else { + super.load(); + } } setup() { @@ -62,7 +62,7 @@ class WordMemory extends WordQuiz { if (this.words) { const aspect = this.form.clientWidth / window.innerHeight; //TODO image ratio - let count = 35; + let count = parseInt(this.preset.n) || 35; let cols = Math.round(Math.sqrt(count) * aspect**.5); count = cols * Math.ceil(count / cols); this.form.style['grid-template-columns'] = `repeat(${cols}, 1fr)`;