mirror of https://github.com/dirtbags/moth.git
stub submit event
This commit is contained in:
parent
551afe04a5
commit
18c5f044cc
|
@ -20,9 +20,7 @@
|
|||
<ul id="files"></ul>
|
||||
<p>Puzzle by <span id="authors">[loading]</span></p>
|
||||
</section>
|
||||
<form>
|
||||
<input type="hidden" name="cat">
|
||||
<input type="hidden" name="points">
|
||||
<form class="answer">
|
||||
Team ID: <input type="text" name="id"> <br>
|
||||
Answer: <input type="text" name="answer" id="answer"> <span id="answer_ok"></span><br>
|
||||
<input type="submit" value="Submit">
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue