+ return selection;
+ }
+
+ configure(params = hashparams()) {
+ const opts = new Map(params.map(arg => arg.split(/[:=](.*)/)));
+ for (let [query, val] of opts) {
+ if (query.match(/^\d+$/)) {
+ this.preset.cat = [parseInt(query)];
+ }
+ else if (query === 'level') {
+ this.preset.level = parseInt(val);
+ }
+ else if (query === 'debug') {
+ this.preset.debug = true;
+ }
+ else {
+ this.preset[query] = val;
+ }
+ }
+ this.preset.dataurl = `/data/wordlist.${this.preset.lang}.json`
+ }
+
+ setup() {
+ this.form = document.getElementById('quiz');
+ }
+
+ load() {
+ this.configure();
+ fetch(this.preset.dataurl).then(res => res.json()).then(json => {