index.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  5. <meta name="description" content="Starmire - a text-based multiplayer dungeon" />
  6. <meta name="keywords" content="starmire mud" />
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  8. <title>Starmire MUD</title>
  9. <!--sharing tags -->
  10. <meta property="og:title" content="Starmire" />
  11. <meta property="og:description" content="Starmire - a text-based multiplayer dungeon" />
  12. <meta property="og:url" content="http://starmire.eyeofmidas.com/" />
  13. <link href="https://fonts.googleapis.com/css?family=Quicksand" rel="stylesheet">
  14. <link rel="stylesheet" media="screen" href="./css/main.css">
  15. </head>
  16. <body>
  17. <header id="background-container">
  18. <h1>Starmire</h1>
  19. <div id="current"></div>
  20. </header>
  21. <nav>
  22. <ul>
  23. <li><a href="./">Home</a></li>
  24. <li><a href="/terminal.html" target="_blank" onclick="window.open('/terminal.html','Starmire Terminal','resizable,height=800,width=600,scrollbars=yes'); return false;">Play</a></li>
  25. <li><a href="#info">Info</a></li>
  26. <li><a href="#register">Register</a></li>
  27. <li><a href="#contact">Contact</a></li>
  28. </ul>
  29. </nav>
  30. <main>
  31. <section id="hero-section">
  32. <div class="hero-banner"></div>
  33. <div class="hero-banner-call-to-action"><a href="#register" class="button">Register</a>
  34. <a href="/terminal.html" target="_blank" onclick="window.open('/terminal.html','Starmire Terminal','resizable,height=800,width=600,scrollbars=yes'); return false;" class="button">Play</a></div>
  35. </section>
  36. <section id="info-section">
  37. <h2 id="info">Info</h2>
  38. <p>Starmire is a text-based multiplayer game that allows ultimate flexibility in who you are and how you play. Blah blah blah.</p>
  39. <h3>Types of Play</h3>
  40. <p>Starmire works hard to make sure there is content for each type of player.
  41. <img src="./images/types_of_players.png" style="width: 50%; display: block; margin-left: auto; margin-right: auto;"/>
  42. <div><a href="/terminal.html" target="_blank" onclick="window.open('/terminal.html','Starmire Terminal','resizable,height=800,width=600,scrollbars=yes'); return false;" class="button">Play</a></div>
  43. </section>
  44. <section id="spacer-section-1">
  45. <div class="hero-banner"></div>
  46. </section>
  47. <section id="register-section">
  48. <h2 id="register">Register</h2>
  49. <div><div id="registrationError"></div><form method="POST" action="/api/register" id="registrationForm">
  50. <input type="username" id="username" name="username" placeholder="username" />
  51. <input type="password" id="password" name="password" placeholder="password" />
  52. <input type="submit" id="submitRegistration" />
  53. </form><div id="registrationSuccess"></div></div>
  54. </section>
  55. <section id="spacer-section-1">
  56. <div class="hero-banner"></div>
  57. </section>
  58. <section id="contact-section">
  59. <h2 id="contact">Contact</h2>
  60. <div>Contact Info</div>
  61. </section>
  62. </main>
  63. <footer>
  64. <p>Website Provided by <a href="http://copperwirehosting.com" target="_blank">Copper Wire Hosting</a></p>
  65. </footer>
  66. <script>
  67. document.addEventListener('DOMContentLoaded', function(event) {
  68. var request = new XMLHttpRequest();
  69. request.open("GET", "/api/current", true);
  70. request.addEventListener("load", function () {
  71. var data = JSON.parse(this.responseText);
  72. if(data.players.length > 0) {
  73. var ulElement = document.createElement("ul");
  74. ulElement.className = "player-list";
  75. for(var i in data.players) {
  76. var playerName = data.players[i];
  77. var nameNode = document.createTextNode(playerName);
  78. var liElement = document.createElement("li");
  79. liElement.appendChild(nameNode);
  80. ulElement.appendChild(liElement);
  81. }
  82. var currentElement = document.getElementById('current');
  83. currentElement.innerHTML = "";
  84. currentElement.appendChild(ulElement);
  85. }
  86. });
  87. request.send();
  88. });
  89. document.getElementById("registrationForm").addEventListener("submit", function(event) {
  90. event.preventDefault();
  91. var form = document.getElementById("registrationForm");
  92. var usernameElement = document.getElementById("username");
  93. var passwordElement = document.getElementById("password");
  94. var params = [];
  95. params.push(encodeURIComponent(usernameElement.name) + '=' + encodeURIComponent(usernameElement.value));
  96. params.push(encodeURIComponent(passwordElement.name) + '=' + encodeURIComponent(passwordElement.value));
  97. params = params.join('&');
  98. var request = new XMLHttpRequest();
  99. request.open(form.method, form.action);
  100. request.setRequestHeader("Content-type", "application/x-form-urlencoded");
  101. request.addEventListener("load", function() {
  102. var response = JSON.parse(request.response);
  103. if(response.status != "ok") {
  104. document.getElementById("registrationError").innerHTML = response.error;
  105. } else {
  106. document.getElementById("registrationError").style.display = "none";
  107. document.getElementById("registrationSuccess").innerHTML = "Registration successful! Please connect via telnet or the <a href=\"/terminal.html\" target=\"_blank\">browser</a>.";
  108. document.getElementById("registrationForm").parentNode.removeChild(document.getElementById("registrationForm"));
  109. }
  110. });
  111. request.send(params);
  112. return true;
  113. })
  114. </script>
  115. </body>
  116. </html>