diff options
Diffstat (limited to 'assets')
| -rw-r--r-- | assets/client.js | 5 | ||||
| -rw-r--r-- | assets/index.html | 19 | ||||
| -rw-r--r-- | assets/room.html | 2 | ||||
| -rw-r--r-- | assets/style.css | 8 | 
4 files changed, 25 insertions, 9 deletions
| diff --git a/assets/client.js b/assets/client.js index f888104..b23222c 100644 --- a/assets/client.js +++ b/assets/client.js @@ -156,14 +156,15 @@ function createCursor(id, name, clr) {    return cursor;  }  function movSelWin(win, x, y) { +  let anch = board_elem.getBoundingClientRect();    let tpos = tilepos(x, y);    if (tpos.x > (bwidth - 1) || tpos.x < 0 || tpos.y > (bheight - 1) || tpos.y < 0) {      win.style.display = "none";    } else {      win.style.display = "";    } -  win.style.left = ((tpos.x + 0.5) * tile_w) + 'px'; -  win.style.top = ((tpos.y + 0.5) * tile_h) + 'px'; +  win.style.left = (anch.x + (tpos.x * tile_w)) + 'px'; +  win.style.top  = (anch.y + ((tpos.y + 0.35) * tile_h)) + 'px';    win.style.width = tile_w + 'px';    win.style.height = tile_h + 'px';  } diff --git a/assets/index.html b/assets/index.html index 4571428..6fc9c46 100644 --- a/assets/index.html +++ b/assets/index.html @@ -7,7 +7,20 @@      <link rel="stylesheet" type="text/css" href="s.css">    </head>    <body> -    <form method="post" action="r"> +    <div id="rlist" class="cent"></div> +    <script> +      let rlist = document.getElementById('rlist'); +      fetch('rlist').then(r => r.json()).then(rooms => { +        rooms.forEach(x => { +          let a = document.createElement('a'); +          a.appendChild(document.createTextNode(x)); +          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> @@ -19,8 +32,8 @@            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"></label><br> -        <label>always safe first move <input name="ralwayssafe1move" type="checkbox"></label><br> +        <label>public, ie. shown in the lobby <input name="raccess" type="checkbox" checked></label><br> +        <label>always safe first move <input name="ralwayssafe1move" type="checkbox" checked></label><br>          <label>player limit<input name="rlimit" type="number" value="32"></label><br>          <button>create</button>        </fieldset> diff --git a/assets/room.html b/assets/room.html index e3e6ff9..27f9ae1 100644 --- a/assets/room.html +++ b/assets/room.html @@ -7,7 +7,7 @@      <link rel="stylesheet" type="text/css" href="/s.css">    </head>    <body> -    <div> +    <div class="cent">        <div id="board-container">        <span id="board"></span>        </div> diff --git a/assets/style.css b/assets/style.css index a8936e6..d217b8d 100644 --- a/assets/style.css +++ b/assets/style.css @@ -6,14 +6,16 @@    font-size: 36px;    line-height: 22px;  } +.cent { +  width: 80vmin; +  margin: 0 auto; +} +  body {    font-family: vt323, monospace;    background-color: black;    color: white;  } -form { -  margin: 0 auto; -}  .unsel {    -webkit-touch-callout: none;    -webkit-user-select: none; | 
