Loading static/js/yalikejazz.mjs +18 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ import { pooltest } from "./exercises.mjs" import { getHandInToken } from "./snakeoil.mjs" import { createExerciseCard, displayAsSolved, displayAsNonCurrent, displayAsCurrent } from "./exercises.cards.mjs" let currentTest = pooltest let currentTest = null /** * Create a DOM card for the given exercise, displays is as solved if solved and inits event listeners Loading Loading @@ -93,7 +93,24 @@ function initActionLinks() { }) } function redirectToPractice() { // TODO Use something nicer based on URLSearchParams location.search = `?test=practice` } export function main() { const params = new URLSearchParams(location.search) const testId = params.get("id") if(testId === "pooltest") { currentTest = pooltest } else if(testId === "practice") { currentTest = null } else { // When no testId is provided or it is an unknown one, redirect to something working redirectToPractice() } document.querySelector("#testName").textContent = currentTest.name document.querySelector("#exerciseCnt").textContent = currentTest.exercises.length document.title = `${currentTest.name} · ${document.title}` Loading Loading
static/js/yalikejazz.mjs +18 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ import { pooltest } from "./exercises.mjs" import { getHandInToken } from "./snakeoil.mjs" import { createExerciseCard, displayAsSolved, displayAsNonCurrent, displayAsCurrent } from "./exercises.cards.mjs" let currentTest = pooltest let currentTest = null /** * Create a DOM card for the given exercise, displays is as solved if solved and inits event listeners Loading Loading @@ -93,7 +93,24 @@ function initActionLinks() { }) } function redirectToPractice() { // TODO Use something nicer based on URLSearchParams location.search = `?test=practice` } export function main() { const params = new URLSearchParams(location.search) const testId = params.get("id") if(testId === "pooltest") { currentTest = pooltest } else if(testId === "practice") { currentTest = null } else { // When no testId is provided or it is an unknown one, redirect to something working redirectToPractice() } document.querySelector("#testName").textContent = currentTest.name document.querySelector("#exerciseCnt").textContent = currentTest.exercises.length document.title = `${currentTest.name} · ${document.title}` Loading