-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjoin.html
More file actions
87 lines (70 loc) · 1.84 KB
/
Copy pathjoin.html
File metadata and controls
87 lines (70 loc) · 1.84 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Join Server</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
body {
margin: 0;
background: #3b3b3b;
font-family: 'Press Start 2P', monospace;
color: white;
text-shadow: 2px 2px #000;
padding: 20px;
}
label {
display: block;
margin-top: 20px;
font-size: 14px;
}
input {
width: 95%;
padding: 10px;
margin-top: 8px;
font-size: 14px;
border: 3px solid #000;
background: #d9d9d9;
}
button {
margin-top: 25px;
width: 100%;
padding: 15px;
background: #4c7f4c;
border: 4px solid #2e4d2e;
color: white;
cursor: pointer;
font-family: 'Press Start 2P';
}
button:hover {
background: #6aa96a;
}
</style>
</head>
<body>
<h2>Join Server</h2>
<label>Player Username</label>
<input id="username" placeholder="Steve123">
<label>Server ID</label>
<input id="serverId" placeholder="ABC123">
<button onclick="submitJoin()">Join</button>
<script type="module">
import { doesServerExist } from "./src/networking/server.js";
async function submitJoin() {
const username = document.getElementById("username").value;
const serverId = document.getElementById("serverId").value;
if (username.trim() === "" || serverId.trim() === "") {
alert("Please enter both a username and server ID.");
return;
}
const exists = await doesServerExist(serverId);
if (!exists) {
alert("No server found with the given ID. Please check the ID and try again.");
return;
}
console.log("Joining server:", serverId, "as", username);
}
window.submitJoin = submitJoin;
</script>
</body>
</html>