<!DOCTYPE html>
<html>
  <head>
    <title>Redeem Token</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 erpdert() {
  let vals = document.querySelector("[name=token]").value.split(":");
  document.querySelector("[name=cat]").value = vals[0];
  document.querySelector("[name=points]").value = vals[1];
  document.querySelector("[name=answer]").value = vals[2];
}

function init() {
  document.querySelector("[name=token]").addEventListener("input", erpdert);
}

if (document.readyState === "loading") {
  document.addEventListener("DOMContentLoaded", init);
} else {
  init();
}
    </script>
  </head>
  <body>
    <h1>Redeem Token</h1>
    <form action="token" method="post">
      <input type="hidden" name="cat">
      <input type="hidden" name="points">
      <input type="hidden" name="answer">
      Team ID: <input type="text" name="id"> <br>
      Token: <input type="text" name="token"> <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>