This commit is contained in:
Prajith Kesava Prasad 2020-10-08 15:47:56 +00:00 committed by GitHub
commit 248bede779
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -765,16 +765,22 @@ chatInput.addEventListener("keypress", function (event) {
// Make links clickable
msg = msg.autoLink();
// Send message over data channel
if (isEmptyOrSpaces(msg) == false) {
dataChanel.send("mes:" + msg);
// Add message to screen
addMessageToScreen(msg, true);
}
// Auto scroll chat down
chatZone.scrollTop(chatZone[0].scrollHeight);
// Clear chat input
chatInput.value = "";
chatInput.value = "";
}
});
function isEmptyOrSpaces(str){
return str === null || str.match(/^ *$/) !== null;
}
// Called when a message is recieved over the dataChannel
function handleRecieveMessage(msg) {
// Add message to screen