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

Generate permalink contents

parent ce9b436f
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/. */
"use strict";
const version = "$Id: quiz.js,v 1.21 2024/01/21 11:04:51 oj14ozun Exp oj14ozun $";
const version = "$Id: quiz.js,v 1.22 2024/01/21 12:38:48 oj14ozun Exp oj14ozun $";
const js_version = document.getElementById("js-version");
js_version.innerText = version;
......@@ -25,6 +25,7 @@ const stats = document.getElementById("stats");
const report = document.getElementById("report");
const correct = document.getElementById("correct");
const wrong = document.getElementById("wrong");
const perma = document.getElementById("perma");
const class_list = document.documentElement.classList;
......@@ -80,6 +81,15 @@ function remember(q, ok) {
}
function pick() {
const qid = new URLSearchParams(window.location.search).get("show");
if (qid) {
const q = questions.find(q => q.id == qid);
if (q) {
return q;
}
console.error("Invalid ID: " + qid);
}
let choice = questions[0];
let worst = evaluate(choice);
......@@ -176,6 +186,9 @@ function next() {
let title = `Problem mit der Frage: "${text.innerText}" (${q.source})`;
let desc = "(Ersetze diesen Text mit einer Beschreibung des Problems)"
report.href = `${gitlab_base}/issues/new?issue[title]=${encodeURIComponent(title)}&issue[description]=${encodeURIComponent(desc)}`;
// update permalink
perma.href = `?show=${encodeURIComponent(q.id)}`;
}
function 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