';
}
+
+ // Add the content of the message in the new box.
messagesText += fancyText(messages[i].content) + "
";
}
@@ -93,11 +112,14 @@ function addMessages(messages) {
' + thisTime + '\
';
+ // Add all the new created messaged to the chat.
$("#chat-history").append(messagesText);
+ // Scroll down, so the user can see the new messages.
$("#chat-history").scrollTop($("#chat-history")[0].scrollHeight - $('#chat-history')[0].clientHeight);
}
+// Switch to a different user.
function switchUser(userID) {
previousDate = new Date("1970-01-01 00:00:00");
$(".chat-field").show();
@@ -108,6 +130,7 @@ function switchUser(userID) {
$("#friend-item-" + userID).addClass("active-friend-chat");
}
+// Insert a message in the chat, this is used when it is empty.
function sayEmpty() {
$("#chat-history").html("Probeer ook eens foto's en video's te sturen");
}
\ No newline at end of file
diff --git a/website/public/js/main.js b/website/public/js/main.js
index 7741406..b6ab703 100644
--- a/website/public/js/main.js
+++ b/website/public/js/main.js
@@ -14,14 +14,14 @@ function fancyText(text) {
return "