From 18c5f044ccd1f77d565f61270d6b9ad517e663dc Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Fri, 8 Sep 2023 18:11:36 -0600 Subject: [PATCH] stub submit event --- theme/puzzle.html | 4 +--- theme/puzzle.mjs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/theme/puzzle.html b/theme/puzzle.html index 46c1ad9..e5a22f3 100644 --- a/theme/puzzle.html +++ b/theme/puzzle.html @@ -20,9 +20,7 @@

Puzzle by [loading]

-
- - + Team ID:
Answer:
diff --git a/theme/puzzle.mjs b/theme/puzzle.mjs index 76581fc..43fa17d 100644 --- a/theme/puzzle.mjs +++ b/theme/puzzle.mjs @@ -1,5 +1,13 @@ import * as moth from "./moth.mjs" +/** Stores the current puzzle, globally */ +let puzzle = null + +function submit(event) { + event.preventDefault() + console.log(event) +} + function puzzleElement(clear=true) { let e = document.querySelector("#puzzle") if (clear) { @@ -16,7 +24,7 @@ function error(message) { async function loadPuzzle(category, points) { let server = new moth.Server() - let puzzle = server.GetPuzzle(category, points) + puzzle = server.GetPuzzle(category, points) await puzzle.Populate() let title = `${category} ${points}` @@ -49,6 +57,9 @@ function hashchange() { } function init() { + for (let e of document.querySelectorAll("form.answer")) { + e.addEventListener("submit", submit) + } window.addEventListener("hashchange", hashchange) hashchange() }