From: Mischa POSLAWSKY Date: Thu, 30 Dec 2021 04:57:50 +0000 (+0100) Subject: word/quiz: common base class for all subpages X-Git-Tag: v1.13~67 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/af99f42e425d0fd4e22d92458d5dc2049429d684 word/quiz: common base class for all subpages Only json loading from multichoice to start with. --- diff --git a/word/memory.js b/word/memory.js index c3adfd4..375b7c1 100644 --- a/word/memory.js +++ b/word/memory.js @@ -1,4 +1,4 @@ -class WordMemory { +class WordMemory extends WordQuiz { turn(click) { let target = click.currentTarget; if (!target.classList.contains('turn')) { @@ -37,7 +37,7 @@ class WordMemory { .forEach(card => put(card, '!.turn!.bad')); } - constructor() { + load(dataurl) { this.dataurl = '/data/wordpairs.json'; fetch(this.dataurl).then(res => res.json()).then(pairs => { this.turned = []; @@ -55,5 +55,3 @@ class WordMemory { }); } }; - -new WordMemory(); diff --git a/word/memory.plp b/word/memory.plp index 8aa952c..d0364e4 100644 --- a/word/memory.plp +++ b/word/memory.plp @@ -3,6 +3,7 @@ Html({ raw => <<'EOT', +