git.shiar.nl
/
sheet.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
word/quiz: common base class for all subpages
[sheet.git]
/
word
/
quiz.js
1
class WordQuiz {
2
dataselect(json) {
3
let rows = Object.values(json);
4
return rows.sort(() => {return .5 - Math.random()}) // shuffle
5
}
6
7
load(dataurl) {
8
fetch(dataurl).then(res => res.json()).then(json => {
9
this.words = this.dataselect(json)
10
this.setup();
11
});
12
}
13
14
constructor(dataurl) {
15
this.load(dataurl);
16
}
17
}