This repository has been archived by the owner on Jul 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
55 lines (54 loc) · 2.63 KB
/
index.html
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
50
51
52
53
54
55
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="css/form.css">
<script type="text/javascript" src="getkey.js"></script>
</head>
<body>
<header>
<h1 id="title">Join A Supernova Game</h1>
<a id="anotherlink" style="display:none" href="https://md-y.github.io/supernova/">Join Another</a>
</header>
<a href="https://github.com/md-y/supernova/wiki" target="_blank">How to play</a>
<div class="form">
<p id="serverlabel">Server Address</p>
<input type="text" id="address" required="required">
Username
<input type="text" id="username" required="required">
Player Color <br>
<iframe src="../embed/colorpicker.html" name="color" width="185" height="125"></iframe>
<input type="button" onclick="join()" value="Join" class="final">
</div>
<h4>Servers</h4>
<a href="https://md-y.github.io/supernova/?server=aHR0cHM6Ly9zdXBlcm5vdmEtbm9kZS5oZXJva3VhcHAuY29tLw=="><img src="https://img.shields.io/badge/Heroku-Join-brightgreen.svg" alt="Server"></a>
</body>
<script>
var address, username, color;
window.onload = function() {
username = document.getElementById("username");
address = document.getElementById("address");
var serverkey = window.atob(getKey(location.href, "server", ""));
address.value = serverkey;
if (serverkey != "") {
document.getElementById("title").innerHTML = "Joining " + serverkey;
address.style.display = "none";
document.getElementById("serverlabel").style.display = "none";
document.getElementById("anotherlink").style.display = "inline";
}
color = window.frames[0].window;
color.setMax(200);
color.setColor( Math.floor(Math.random() * 200),
Math.floor(Math.random() * 200),
Math.floor(Math.random() * 200));
}
function join() {
if (address.validity.valid && username.validity.valid) {
location.href = "https://md-y.github.io/supernova/client?server=" +
window.btoa(address.value) + "?name=" +
window.btoa(username.value) + "?color=" +
color.hex().split("#")[1];
}
}
</script>
</html>