mirror of
https://github.com/ianramzy/decentralized-video-chat.git
synced 2025-02-23 00:15:04 +08:00
fix text chat css
This commit is contained in:
parent
ad05f4dcd4
commit
7e0521cf15
@ -720,12 +720,20 @@ function recieveCaptions(captions) {
|
|||||||
|
|
||||||
// Text Chat
|
// Text Chat
|
||||||
// Add text message to chat screen on page
|
// Add text message to chat screen on page
|
||||||
function addMessageToScreen(msg) {
|
function addMessageToScreen(msg, isOwnMessage) {
|
||||||
$(".chat-messages").append(
|
if (isOwnMessage) {
|
||||||
'<div class="message-item customer cssanimation fadeInBottom"><div class="message-bloc"><div class="message">' +
|
$(".chat-messages").append(
|
||||||
msg +
|
'<div class="message-item customer cssanimation fadeInBottom"><div class="message-bloc"><div class="message">' +
|
||||||
"</div></div></div>"
|
msg +
|
||||||
);
|
"</div></div></div>"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$(".chat-messages").append(
|
||||||
|
'<div class="message-item moderator cssanimation fadeInBottom"><div class="message-bloc"><div class="message">' +
|
||||||
|
msg +
|
||||||
|
"</div></div></div>"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Listen for enter press on chat input
|
// Listen for enter press on chat input
|
||||||
@ -741,7 +749,7 @@ chatInput.addEventListener("keypress", function (event) {
|
|||||||
// Send message over data channel
|
// Send message over data channel
|
||||||
dataChanel.send("mes:" + msg);
|
dataChanel.send("mes:" + msg);
|
||||||
// Add message to screen
|
// Add message to screen
|
||||||
addMessageToScreen(msg);
|
addMessageToScreen(msg, true);
|
||||||
// Auto scroll chat down
|
// Auto scroll chat down
|
||||||
chatZone.scrollTop(chatZone[0].scrollHeight);
|
chatZone.scrollTop(chatZone[0].scrollHeight);
|
||||||
// Clear chat input
|
// Clear chat input
|
||||||
@ -752,7 +760,7 @@ chatInput.addEventListener("keypress", function (event) {
|
|||||||
// Called when a message is recieved over the dataChannel
|
// Called when a message is recieved over the dataChannel
|
||||||
function handleRecieveMessage(msg) {
|
function handleRecieveMessage(msg) {
|
||||||
// Add message to screen
|
// Add message to screen
|
||||||
addMessageToScreen(msg);
|
addMessageToScreen(msg, false);
|
||||||
// Auto scroll chat down
|
// Auto scroll chat down
|
||||||
chatZone.scrollTop(chatZone[0].scrollHeight);
|
chatZone.scrollTop(chatZone[0].scrollHeight);
|
||||||
// Show chat if hidden
|
// Show chat if hidden
|
||||||
|
Loading…
x
Reference in New Issue
Block a user