From: Mischa POSLAWSKY Date: Thu, 30 Dec 2021 07:14:29 +0000 (+0100) Subject: word/quiz: category selection from location hash X-Git-Tag: v1.13~52 X-Git-Url: http://git.shiar.net/sheet.git/commitdiff_plain/1d174caf0e66efe73a17b6fefb11abe8df2b0750 word/quiz: category selection from location hash --- diff --git a/word/quiz.js b/word/quiz.js index e2e8cb6..187aea7 100644 --- a/word/quiz.js +++ b/word/quiz.js @@ -44,6 +44,14 @@ class WordQuiz { load(dataurl) { this.preset = {}; + let input; + if (input = window.location.hash.match(/\d+/)) { + this.preset.cat = input[0]; + } + if (window.location.hash.match(/a/)) { + this.preset.level = 2; + } + fetch(dataurl).then(res => res.json()).then(json => { this.words = this.dataselect(json) this.setup();