summaryrefslogtreecommitdiff
path: root/assets/index.html
blob: 9517529fc7822caab16bd14be4c2efe2bbf1266c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>websweeper</title>
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link rel="stylesheet" type="text/css" href="./s.css">
  </head>
  <body>
    <div id="rlist" class="cent"></div>
    <script>
      let rlist = document.getElementById('rlist');
      fetch('rlist').then(r => r.json()).then(rooms => {
        Object.keys(rooms).forEach(x => {
          let roominfo = JSON.parse(rooms[x]);
          let bc = roominfo.board_conf;
          let a = document.createElement('a');
          let h1 = document.createElement('h1');
                h1.appendChild(document.createTextNode(`> ${roominfo.name}`));
          let h4 = document.createElement('h4');
          h4.appendChild(document.createTextNode(`${bc.w} by ${bc.h} with ${bc.mine_ratio[0]} in every ${bc.mine_ratio[1]} tiles mined`));
          a.append(h1);
          a.append(h4);
          a.href = 'room/' + x;
          rlist.append(a);
          rlist.append(document.createElement('br'));
        });
      });
    </script>
    <form method="post" action="r" class="cent">
      <fieldset>
        <legend>-={ Create a new room }=-</legend>
        <label>room name<input name="rname" type="text" autofocus></label><br>
        <label>board dimensions<br>
          <input name="rwidth" type="number" value="30" required>
          x
          <input name="rheight" type="number" value="20" required><br>
          where<input name="rration" type="number" value="1" required>
          in every<input name="rratiod" type="number" value="8" required>
          tiles are mines
        </label><br>
        <label>public, ie. shown in the lobby <input name="raccess" type="checkbox" checked></label><br>
        <label>safe first move (if possible)<input name="ralwayssafe1move" type="checkbox" checked></label><br>
        <label>player limit<input name="rlimit" type="number" value="32"></label><br>
        <button>create</button>
      </fieldset>
      <form>
  </body>
</html>