mirror of https://github.com/dirtbags/moth.git
Add some more files
This commit is contained in:
parent
ba38d1a84b
commit
b8a5d379bb
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Welcome</title>
|
||||
<link rel="stylesheet" href="basic.css">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="icon" href="res/icon.svg" type="image/svg+xml"
|
||||
><link rel="icon" href="res/icon.png" type="image/png">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Welcome</h1>
|
||||
<section>
|
||||
<h2>Register your team</h2>
|
||||
|
||||
<form action="register" method="post">
|
||||
Team ID: <input name="id"> <br>
|
||||
Team name: <input name="name">
|
||||
<input type="submit" value="Register">
|
||||
</form>
|
||||
|
||||
<p>
|
||||
If someone on your team has already registered,
|
||||
proceed to the
|
||||
<a href="puzzle-list.html">puzzles overview</a>.
|
||||
</p>
|
||||
</section>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="puzzle-list.html">Puzzles</a></li>
|
||||
<li><a href="scoreboard.html">Scoreboard</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,58 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Puzzle</title>
|
||||
<link rel="stylesheet" href="basic.css">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="icon" href="res/icon.svg" type="image/svg+xml">
|
||||
<link rel="icon" href="res/icon.png" type="image/png">
|
||||
<script>
|
||||
function render(obj) {
|
||||
let body = document.getElementById("body");
|
||||
body.innerHTML = obj.body;
|
||||
console.log("XXX: Munge relative URLs (src= and href=) in body")
|
||||
}
|
||||
function init() {
|
||||
let params = new URLSearchParams(window.location.search);
|
||||
let categoryName = params.get("cat");
|
||||
let points = params.get("points");
|
||||
let puzzleId = params.get("pid");
|
||||
|
||||
let fn = "content/" + categoryName + "/" + puzzleId + "/puzzle.json";
|
||||
|
||||
fetch(fn)
|
||||
.then(function(resp) {
|
||||
return resp.json();
|
||||
}).then(function(obj) {
|
||||
render(obj);
|
||||
}).catch(function(err) {
|
||||
console.log("Error", err);
|
||||
});
|
||||
|
||||
document.querySelector("body > h1").innerText = categoryName + " " + points
|
||||
document.querySelector("input[name=cat]").value = categoryName;
|
||||
document.querySelector("input[name=points]").value = points;
|
||||
}
|
||||
document.addEventListener("DOMContentLoaded", init);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Puzzle</h1>
|
||||
<section>
|
||||
<div id="body">Loading...</div>
|
||||
</section>
|
||||
<form action="answer" method="post">
|
||||
<input type="hidden" name="cat">
|
||||
<input type="hidden" name="points">
|
||||
Team ID: <input type="text" name="id"> <br>
|
||||
Answer: <input type="text" name="answer"> <br>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="puzzle-list.html">Puzzles</a></li>
|
||||
<li><a href="scoreboard.html">Scoreboard</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue