FumesAI
commited on
Commit
•
cf9e277
1
Parent(s):
bbc1e9b
Update index.html
Browse files- index.html +18 -14
index.html
CHANGED
@@ -162,20 +162,24 @@
|
|
162 |
document.getElementById('userCount').innerText = `Online Users: ${onlineUsersCount}`
|
163 |
});
|
164 |
function sendMessage() {
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
}
|
178 |
-
|
|
|
|
|
|
|
|
|
179 |
userInput.addEventListener("keypress", function(event) {
|
180 |
if (event.keyCode === 13) {
|
181 |
if(!document.getElementById('btn').disabled){
|
|
|
162 |
document.getElementById('userCount').innerText = `Online Users: ${onlineUsersCount}`
|
163 |
});
|
164 |
function sendMessage() {
|
165 |
+
document.getElementById('btn').disabled = true;
|
166 |
+
setTimeout(function(){
|
167 |
+
document.getElementById('btn').disabled = false;
|
168 |
+
}, 5000); // 5000 milliseconds = 5 seconds
|
169 |
+
|
170 |
+
var message = userInput.value;
|
171 |
+
if (message.length > 1200) {
|
172 |
+
alert('Message length exceeds 1200 characters!!');
|
173 |
+
} else {
|
174 |
+
var data = {
|
175 |
+
user: user,
|
176 |
+
message: message
|
177 |
+
};
|
178 |
+
socket.emit('message', data);
|
179 |
+
userInput.value = '';
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
userInput.addEventListener("keypress", function(event) {
|
184 |
if (event.keyCode === 13) {
|
185 |
if(!document.getElementById('btn').disabled){
|