-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
147 lines (145 loc) · 3.79 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<!DOCTYPE html>
<html>
<head>
<title>Chat Application</title>
<link rel="icon" type="image/x-icon" href="favicon.ico">
<style>
body {
font-family: "Balthazar", serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #751662;
}
.balthazar-regular {
font-family: "Balthazar", serif;
font-weight: 400;
font-style: normal;
}
.chat-container {
background-color: #fff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 90%;
max-width: 500px;
padding: 20px;
text-align: center;
}
.chat-title {
font-size: 24px;
font-weight: bold;
margin-bottom: 20px;
font-family: "Balthazar", serif;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
max-height: 300px;
overflow-y: auto;
border: 1px solid #ddd;
border-radius: 4px;
padding: 10px;
background-color: #f9f9f9;
text-align: left;
display: none; /* Hide initially */
}
li {
padding: 8px;
margin-bottom: 10px;
background-color: #f4f4f4;
border-radius: 4px;
display: flex;
justify-content: space-between;
align-items: center;
}
.message-text {
flex: 1;
}
.message-time {
color: #888;
font-size: 0.8em;
margin-left: 5px;
}
form {
display: flex;
margin-top: 10px;
}
input {
padding: 10px;
width: 100%;
border: 1px solid #ddd;
border-radius: 4px 0 0 4px;
box-sizing: border-box;
}
button {
padding: 10px;
background-color: #000000;
color: #fff;
border: none;
cursor: pointer;
}
button:hover {
background-color: #751662;
}
#username-form {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 20px;
}
#username {
padding: 10px;
width: 80%;
border: 1px solid #ddd;
border-radius: 4px;
margin-bottom: 10px;
}
#exit {
padding: 10px;
background-color: #dc3545;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
margin-top: 10px;
}
#exit:hover {
background-color: #c82333;
}
#clear {
padding: 10px;
background-color: #6c757d;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
margin-top: 10px;
}
#clear:hover {
background-color: #5a6268;
}
</style>
</head>
<body>
<div class="chat-container">
<div class="chat-title">The Local Chat Room by Aniya Stanford</div>
<form id="username-form">
<input id="username" type="text" placeholder="Enter your name" required />
<button type="submit">Join Chat</button>
</form>
<ul id="messages"></ul>
<form id="form" action="" style="display:none;">
<input id="input" autocomplete="off" placeholder="Type your message here..." /><button>Send</button>
</form>
<button id="exit" style="display:none;">Exit Chat</button>
<button id="clear" style="display:none;">Clear Chat</button>
</div>
<!-- Include Socket.io client library -->
<script src="/socket.io/socket.io.js"></script>
<!-- Include main JavaScript file -->
<script src="main.js"></script>
</body>
</html>