Update public/index.html
Browse files- public/index.html +8 -10
public/index.html
CHANGED
|
@@ -1,12 +1,10 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html>
|
| 3 |
-
<head>
|
| 4 |
-
<title>Chat App</title>
|
| 5 |
-
</head>
|
| 6 |
<body>
|
| 7 |
-
<h2>
|
| 8 |
|
| 9 |
-
<input id="name" placeholder="Enter
|
| 10 |
<input id="room" placeholder="Enter room code"><br><br>
|
| 11 |
|
| 12 |
<button onclick="createRoom()">Create Room</button>
|
|
@@ -14,15 +12,15 @@
|
|
| 14 |
|
| 15 |
<script>
|
| 16 |
function createRoom() {
|
| 17 |
-
const name =
|
| 18 |
const room = Math.random().toString(36).substr(2, 6);
|
| 19 |
-
window.location
|
| 20 |
}
|
| 21 |
|
| 22 |
function joinRoom() {
|
| 23 |
-
const name =
|
| 24 |
-
const room =
|
| 25 |
-
window.location
|
| 26 |
}
|
| 27 |
</script>
|
| 28 |
</body>
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html>
|
| 3 |
+
<head><title>P2P Chat</title></head>
|
|
|
|
|
|
|
| 4 |
<body>
|
| 5 |
+
<h2>P2P Chat (WebRTC)</h2>
|
| 6 |
|
| 7 |
+
<input id="name" placeholder="Enter name"><br><br>
|
| 8 |
<input id="room" placeholder="Enter room code"><br><br>
|
| 9 |
|
| 10 |
<button onclick="createRoom()">Create Room</button>
|
|
|
|
| 12 |
|
| 13 |
<script>
|
| 14 |
function createRoom() {
|
| 15 |
+
const name = nameInput.value;
|
| 16 |
const room = Math.random().toString(36).substr(2, 6);
|
| 17 |
+
window.location = `/room.html?room=${room}&name=${name}`;
|
| 18 |
}
|
| 19 |
|
| 20 |
function joinRoom() {
|
| 21 |
+
const name = nameInput.value;
|
| 22 |
+
const room = roomInput.value;
|
| 23 |
+
window.location = `/room.html?room=${room}&name=${name}`;
|
| 24 |
}
|
| 25 |
</script>
|
| 26 |
</body>
|