Loading static/js/dialogs.mjs +18 −0 Original line number Diff line number Diff line import { findParent } from "./util.mjs"; /** * Show (or hide) a dialog. * The dialog is not shown if the user has configured the dialog to not be shown again. Loading @@ -17,3 +19,19 @@ export function setDialogShown(id, shown) { document.body.classList.remove(DIALOG_SHOWN); } } /** * Initializes the "don't show this dialog again feature" */ export function initDontShowAgain() { document.querySelectorAll(".dialog .dont-show-again").forEach(el => { const dialog = findParent(el, ".dialog") const storageItemId = `${dialog.id}.dont-show-again` const storedStatus = localStorage.getItem(storageItemId) || false el.checked = storedStatus el.onchange = () => { localStorage.setItem(storageItemId, el.checked) } }) } No newline at end of file static/js/yalikejazz.mjs +2 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ import { createExerciseCard, displayAsSolved, displayAsNonCurrent, displayAsCurr import { Exercise } from "./exercises.api.mjs" import { isVmLoading, onCopyOrPasteHotkey, setAutoFocusEnabled } from "./jslinux.api.mjs" import { findParent, waitFor } from "./util.mjs" import { setDialogShown } from "./dialogs.mjs" import { initDontShowAgain, setDialogShown } from "./dialogs.mjs" const testId = new URLSearchParams(location.search).get("id") const currentTest = tests[testId] Loading Loading @@ -181,6 +181,7 @@ export async function main() { initExerciseList() setExerciseActionButtonsEnabled(false) initActionLinks() initDontShowAgain() startExercise(currentTest.getNextUnsolvedExercise(currentState)) Loading Loading
static/js/dialogs.mjs +18 −0 Original line number Diff line number Diff line import { findParent } from "./util.mjs"; /** * Show (or hide) a dialog. * The dialog is not shown if the user has configured the dialog to not be shown again. Loading @@ -17,3 +19,19 @@ export function setDialogShown(id, shown) { document.body.classList.remove(DIALOG_SHOWN); } } /** * Initializes the "don't show this dialog again feature" */ export function initDontShowAgain() { document.querySelectorAll(".dialog .dont-show-again").forEach(el => { const dialog = findParent(el, ".dialog") const storageItemId = `${dialog.id}.dont-show-again` const storedStatus = localStorage.getItem(storageItemId) || false el.checked = storedStatus el.onchange = () => { localStorage.setItem(storageItemId, el.checked) } }) } No newline at end of file
static/js/yalikejazz.mjs +2 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ import { createExerciseCard, displayAsSolved, displayAsNonCurrent, displayAsCurr import { Exercise } from "./exercises.api.mjs" import { isVmLoading, onCopyOrPasteHotkey, setAutoFocusEnabled } from "./jslinux.api.mjs" import { findParent, waitFor } from "./util.mjs" import { setDialogShown } from "./dialogs.mjs" import { initDontShowAgain, setDialogShown } from "./dialogs.mjs" const testId = new URLSearchParams(location.search).get("id") const currentTest = tests[testId] Loading Loading @@ -181,6 +181,7 @@ export async function main() { initExerciseList() setExerciseActionButtonsEnabled(false) initActionLinks() initDontShowAgain() startExercise(currentTest.getNextUnsolvedExercise(currentState)) Loading