git.shiar.nl
/
sheet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
3232c47
)
word/memory: pick cards to fit grid dimensions
author
Mischa POSLAWSKY
<perl@shiar.org>
Thu, 30 Dec 2021 07:05:35 +0000
(08:05 +0100)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Fri, 31 Dec 2021 04:29:05 +0000
(
05:29
+0100)
word/memory.js
patch
|
blob
|
history
diff --git
a/word/memory.js
b/word/memory.js
index 94836c282b54666093c396631cc56fe17c8840db..24feead78cbfd4d66f3eb79728bce412638e18d4 100644
(file)
--- a/
word/memory.js
+++ b/
word/memory.js
@@
-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 {