Skip to content
Snippets Groups Projects
Commit dd72f615 authored by Philip Kaluđerčić's avatar Philip Kaluđerčić :u7121:
Browse files

Reload site after a permalinked question

parent 1f0197af
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/. */ * http://creativecommons.org/publicdomain/zero/1.0/. */
"use strict"; "use strict";
const version = "$Id: quiz.js,v 1.23 2024/01/21 13:00:54 oj14ozun Exp oj14ozun $"; const version = "$Id: quiz.js,v 1.24 2024/01/21 13:09:44 oj14ozun Exp oj14ozun $";
const js_version = document.getElementById("js-version"); const js_version = document.getElementById("js-version");
js_version.innerText = version; js_version.innerText = version;
...@@ -219,11 +219,6 @@ function submit() { ...@@ -219,11 +219,6 @@ function submit() {
class_list.add("answer"); class_list.add("answer");
class_list.remove("tried"); class_list.remove("tried");
action.disabled = false; action.disabled = false;
// remove any permalink
const url = new URL(window.location);
url.search = "";
window.history.replaceState({} , document.title, url.toString());
} }
// listen to keys // listen to keys
...@@ -254,8 +249,14 @@ document.onkeyup = evt => { ...@@ -254,8 +249,14 @@ document.onkeyup = evt => {
// setup action button // setup action button
action.onclick = _ => { action.onclick = _ => {
if (class_list.contains("answer")) if (class_list.contains("answer")) {
next(); // remove any permalink
if (new URLSearchParams(window.location.search).get("show")) {
window.location.search = "";
} else {
next();
}
}
else if (class_list.contains("tried")) else if (class_list.contains("tried"))
submit(); submit();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment