diff options
author | stale <redkugelblitzin@gmail.com> | 2022-05-20 06:39:58 -0300 |
---|---|---|
committer | stale <redkugelblitzin@gmail.com> | 2022-05-20 06:39:58 -0300 |
commit | fae0fca7aabb81325a296a1d6202239c3db44b60 (patch) | |
tree | 687a95f381ee13ee3de9f8eabdf4cd371a258091 /assets | |
parent | d89b9ea43ac65af549279f6e86c68c66243dcdf3 (diff) |
wip room support
Diffstat (limited to 'assets')
-rw-r--r-- | assets/client.js | 10 | ||||
-rw-r--r-- | assets/index.html | 28 | ||||
-rw-r--r-- | assets/room.html | 6 | ||||
-rw-r--r-- | assets/style.css | 5 |
4 files changed, 41 insertions, 8 deletions
diff --git a/assets/client.js b/assets/client.js index 0e90d4b..f888104 100644 --- a/assets/client.js +++ b/assets/client.js @@ -3,9 +3,11 @@ window.name = "anon"; window.clr = "#f03333"; window.info_elem = document.getElementById("miscinfo"); window.info_elem.innerHTML =` - <input id="name-in" type="text" value="anon"> - <input id="clr-in" type="color" value="#33c033"></input> - <button onclick=register()>Join</button>`; + <form action="javascript:;" onsubmit="register()"> + <input id="name-in" type="text" value="anon"> + <input id="clr-in" type="color" value="#33c033"></input> + <button>Join</button> + </form>`; window.board_elem = document.getElementById("board"); window.bwidth = NaN; window.bheight = NaN; @@ -25,7 +27,7 @@ function register() { function connect() { let wsproto = (window.location.protocol == "https:")? "wss:": "ws:"; - let s = new WebSocket(`${wsproto}//${window.location.hostname}:${window.location.port}${window.location.pathname}ws`); + let s = new WebSocket(`${wsproto}//${location.hostname}:${location.port}${location.pathname}/ws`); s.onopen = function() { s.send(`register ${window.name} ${window.clr}`); } diff --git a/assets/index.html b/assets/index.html new file mode 100644 index 0000000..bb18d1c --- /dev/null +++ b/assets/index.html @@ -0,0 +1,28 @@ +<!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> + <form method="post" action="r"> + <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"></label><br> + <label>player limit (0 for none)<input name="rlimit" type="number"></label><br> + <button>create</button> + </fieldset> + <form> + </body> +</html> diff --git a/assets/room.html b/assets/room.html index f3f130d..e3e6ff9 100644 --- a/assets/room.html +++ b/assets/room.html @@ -4,15 +4,15 @@ <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"> + <link rel="stylesheet" type="text/css" href="/s.css"> </head> <body> - <div class=""> + <div> <div id="board-container"> <span id="board"></span> </div> <p id="miscinfo">Loading...</p> </div> </body> - <script src="c.js"></script> + <script src="/c.js"></script> </html> diff --git a/assets/style.css b/assets/style.css index acdd9c0..a8936e6 100644 --- a/assets/style.css +++ b/assets/style.css @@ -1,6 +1,6 @@ @font-face { font-family: vt323; - src: url("f.ttf"); + src: url("/f.ttf"); } #board-container { font-size: 36px; @@ -11,6 +11,9 @@ body { background-color: black; color: white; } +form { + margin: 0 auto; +} .unsel { -webkit-touch-callout: none; -webkit-user-select: none; |