A simple TicTacToe app with Golang backend and WebSockets gluing it all together.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
2.0 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <title>TicTacToe :: {{ .title }}</title>
  7. <meta name="viewport" content="width=device-width, initial-scale=1">
  8. <link rel="stylesheet" type="text/css" media="screen" href="/static/main.css" />
  9. </head>
  10. <body>
  11. <div class=wrapper>
  12. <h1>TicTacToe</h1>
  13. <h2 id=player class=hide></h2>
  14. <form id=startGameForm>
  15. <label for=name id=nameLabel>To start a new game, enter your name:</label>
  16. <input type=text name=name id=name placeholder="Enter your name/nickname" size=64>
  17. <button type=submit id=start>Start a new game</button>
  18. </form>
  19. <div id=instructions class=hide>
  20. <p>Share this link with a friend to begin:</p>
  21. <div class=link>
  22. <div class=tooltip>
  23. <span class=tooltiptext id=tooltip>Copy</span>
  24. <input type=text id=shareLink onclick="ui.Copy(this)" onmouseout="ui.TooltipBlur()" readonly=readonly>
  25. </div>
  26. </div>
  27. </div>
  28. <div id=status class=hide></div>
  29. <div id=waiting class=hide>Waiting for opponent</div>
  30. <div id=turn class=hide>Your Turn</div>
  31. <div id=winner class=hide>You WIN!!!</div>
  32. </div>
  33. <div id=gameTable class=hide>
  34. <table>
  35. <tr>
  36. <td id=pos_0 class=tile>T</td>
  37. <td id=pos_1 class=tile>I</td>
  38. <td id=pos_2 class=tile>C</td>
  39. </tr>
  40. <tr>
  41. <td id=pos_3 class=tile>T</td>
  42. <td id=pos_4 class=tile>A</td>
  43. <td id=pos_5 class=tile>C</td>
  44. </tr>
  45. <tr>
  46. <td id=pos_6 class=tile>T</td>
  47. <td id=pos_7 class=tile>O</td>
  48. <td id=pos_8 class=tile>E</td>
  49. </tr>
  50. </table>
  51. </div>
  52. <script src="/static/bundle.js"></script>
  53. </body>
  54. </html>