-
Notifications
You must be signed in to change notification settings - Fork 144
/
index.html
70 lines (58 loc) · 2.32 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!--
* @fileName index.html
* @author Amir <[email protected]>
* @date 22-Dec-2016
*
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Chat App</title>
<!-- Favicon -->
<link rel="shortcut icon" href="img/favicon.ico">
<!-- favicon ends -->
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.3/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
.button {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: block;
font-size: 16px;
cursor: pointer;
margin: 0 auto;
}
</style>
<script src="js/config.js"></script>
</head>
<body>
<input type="button" id='createRoom' class="button" value="Create Room">
<div id="roomLink" style="margin-top: 10px; text-align: center"></div>
<script>
var createBtn = document.querySelector("#createRoom");
var linkInput = document.querySelector("#roomLink");
createBtn.onclick = function(){
new Promise(function(resolve, reject){
var room = Math.random().toString(36).slice(2).substring(0, 15);
return room ? resolve(room) : reject(new Error("Could not create room"));
}).then(function(room){
var roomLink =appRoot+"comm.html?room="+room;
linkInput.innerHTML = '<a href="'+roomLink+'" target="_blank">Enter Room</a>';
}).catch(function(err){
linkInput.innerHTML = err;
});
};
</script>
</body>
</html>