From 3039f1c4ae0c0d177042df74e89ddd23ca3aba00 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic <philip.kaludercic@fau.de> Date: Sun, 21 Jan 2024 21:34:05 +0000 Subject: [PATCH] Store progress in localStorage, not sessionStorage --- quiz.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/quiz.js b/quiz.js index d0e1d66..d7891ae 100644 --- a/quiz.js +++ b/quiz.js @@ -7,7 +7,7 @@ * http://creativecommons.org/publicdomain/zero/1.0/. */ "use strict"; -const version = "$Id: quiz.js,v 1.27 2024/01/21 19:34:22 oj14ozun Exp oj14ozun $"; +const version = "$Id: quiz.js,v 1.28 2024/01/21 19:44:14 oj14ozun Exp oj14ozun $"; const js_version = document.getElementById("js-version"); js_version.innerText = version; @@ -69,6 +69,7 @@ function update_stats(q) { wrong.innerText = data.wrong; seen.innerText = (Object.keys(progress).length || 0) + (progress.hasOwnProperty(q.id) ? 0 : 1); + } function remember(q, ok) { @@ -80,8 +81,9 @@ function remember(q, ok) { data["wrong"]++; } + // store in local storage progress[q.id] = data; - window.sessionStorage.setItem("progress", progress); + window.localStorage.setItem("progress", JSON.stringify(progress)); } function pick() { -- GitLab