-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjoin.html
41 lines (33 loc) · 1.2 KB
/
join.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/css/custom.css">
</head>
<body>
<main role="main" class="container">
<div class="d-flex justify-content-center align-items-center container ">
<form id="nameform">
<h1>Join the Game!</h1>
<div class="form-group">
<label for="handle">Type in your name:</label>
<input type="text" class="form-control" id="handle" placeholder="Your name">
</div>
<button type="submit" class="btn btn-primary btn-lg btn-block">Join!</button>
</form>
</div>
</main><!-- /.container -->
<script>
function join(e) {
e.preventDefault();
var currentPath = window.location.pathname; // "/1234"
var videoId = currentPath.substring(1); // "1234"
var name = document.getElementById("handle").value;
window.location.href = "/buzz/" + videoId + "/" + encodeURIComponent(name);
}
document.getElementById("nameform").addEventListener("submit", join);
</script>
</body>
</html>