mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-12-25 02:18: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){
|
addMessage: function(conversationID, messageInfos){
|
||||||
|
|
||||||
console.log(messageInfos);
|
|
||||||
|
|
||||||
//First, check if the conversation informations can be found
|
//First, check if the conversation informations can be found
|
||||||
if(!this.__conversationsCache["conversation-"+conversationID]){
|
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 !");
|
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
|
//Create message element
|
||||||
var messageElem = createElem2({
|
var messageElem = createElem2({
|
||||||
insertAsFirstChild: convInfos.box.messagesArea,
|
appendTo: convInfos.box.messagesArea,
|
||||||
type: "div",
|
type: "div",
|
||||||
class: "direct-chat-msg " + (userIsPoster ? "right" : "")
|
class: "direct-chat-msg " + (userIsPoster ? "right" : "")
|
||||||
});
|
});
|
||||||
@ -728,6 +726,10 @@ ComunicWeb.components.conversations.chatWindows = {
|
|||||||
innerHTML: "Loading",
|
innerHTML: "Loading",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Hide user name if it is the current user
|
||||||
|
if(userIsPoster)
|
||||||
|
usernameElem.style.display = "none";
|
||||||
|
|
||||||
//Add user account image
|
//Add user account image
|
||||||
var userAccountImage = createElem2({
|
var userAccountImage = createElem2({
|
||||||
appendTo: messageElem,
|
appendTo: messageElem,
|
||||||
@ -772,6 +774,17 @@ ComunicWeb.components.conversations.chatWindows = {
|
|||||||
userAccountImage.src = userInfos.accountImage;
|
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
|
//Success
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user