mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-12-24 09:58:51 +00:00
Messages automaticaly go bottom
This commit is contained in:
parent
dd9442b2e6
commit
85b16aec0a
@ -692,8 +692,6 @@ ComunicWeb.components.conversations.chatWindows = {
|
||||
*/
|
||||
addMessage: function(conversationID, messageInfos){
|
||||
|
||||
console.log(messageInfos);
|
||||
|
||||
//First, check if the conversation informations can be found
|
||||
if(!this.__conversationsCache["conversation-"+conversationID]){
|
||||
ComunicWeb.debug.logMessage("Conversation Chat Windows : Error ! Couldn't add a message to the conversation because the conversation was not found !");
|
||||
@ -708,7 +706,7 @@ ComunicWeb.components.conversations.chatWindows = {
|
||||
|
||||
//Create message element
|
||||
var messageElem = createElem2({
|
||||
insertAsFirstChild: convInfos.box.messagesArea,
|
||||
appendTo: convInfos.box.messagesArea,
|
||||
type: "div",
|
||||
class: "direct-chat-msg " + (userIsPoster ? "right" : "")
|
||||
});
|
||||
@ -728,6 +726,10 @@ ComunicWeb.components.conversations.chatWindows = {
|
||||
innerHTML: "Loading",
|
||||
});
|
||||
|
||||
//Hide user name if it is the current user
|
||||
if(userIsPoster)
|
||||
usernameElem.style.display = "none";
|
||||
|
||||
//Add user account image
|
||||
var userAccountImage = createElem2({
|
||||
appendTo: messageElem,
|
||||
@ -772,6 +774,17 @@ ComunicWeb.components.conversations.chatWindows = {
|
||||
userAccountImage.src = userInfos.accountImage;
|
||||
}
|
||||
|
||||
//Enable (again) slimscrool
|
||||
$(convInfos.box.messagesArea).slimscroll({
|
||||
height: "250px",
|
||||
});
|
||||
|
||||
//Scroll to the bottom of the conversation
|
||||
var scrollBottom = $(convInfos.box.messagesArea).prop("scrollHeight")+"px";
|
||||
$(convInfos.box.messagesArea).slimScroll({
|
||||
scrollTo: scrollBottom
|
||||
});
|
||||
|
||||
//Success
|
||||
return true;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user