From 1d174caf0e66efe73a17b6fefb11abe8df2b0750 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 30 Dec 2021 08:14:29 +0100 Subject: [PATCH] word/quiz: category selection from location hash --- word/quiz.js | 8 ++++++++ 1 file changed, 8 insertions(+) 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(); -- 2.30.0