diff options
author | altaf-creator <dev@altafcreator.com> | 2024-07-18 10:39:11 +0700 |
---|---|---|
committer | altaf-creator <dev@altafcreator.com> | 2024-07-18 10:39:11 +0700 |
commit | 599e5bb3b9cf774d4c3680644cf4bd0596fd34c0 (patch) | |
tree | aa697860db979d4b3f82fbbf80141153aa89db26 /scripts/onload/quiz.js | |
parent | 5905c9767d071532c90aaf703108eb6fe6d5971f (diff) |
Start migrating (and rewriting) lessons, NEW FEATURE: quizzes (unfinished)
Diffstat (limited to 'scripts/onload/quiz.js')
-rw-r--r-- | scripts/onload/quiz.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/onload/quiz.js b/scripts/onload/quiz.js new file mode 100644 index 0000000..bf3e729 --- /dev/null +++ b/scripts/onload/quiz.js @@ -0,0 +1,20 @@ +// DEPENDENCIES +// * /scripts/lesson.js +// * /scripts/toc.js +// * /scripts/global.js +window.onload = function() { + updateGlobalElements(); + var btn = document.getElementById("top-back-btn"); + btn.setAttribute("href", `../?id=${getUrlVars()['subject']}`) +} + +function getUrlVars() { + var vars = [], hash; + var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); + for (var i = 0; i < hashes.length; i++) { + hash = hashes[i].split('='); + vars.push(hash[0]); + vars[hash[0]] = hash[1]; + } + return vars; +} |