';
}
+
+ // 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/header.js b/website/public/js/header.js
index 4feea40..e4408cc 100644
--- a/website/public/js/header.js
+++ b/website/public/js/header.js
@@ -11,7 +11,8 @@ $(document).ready(function() {
// Add cookie so the menu stays open on other pages
if (window.innerWidth > 1080) {
- $("#chat-history").width("calc(100% - 587px)");
+ $("#chat-history").css("margin-right", "266px");
+ $("#chat-history").css("width", "calc(100% - 512px - 75px)");
document.cookie = "menu=open; path=/";
} else {
document.cookie = "menu=closed; path=/";
@@ -22,7 +23,8 @@ $(document).ready(function() {
$("#notification-center").css("display", "none");
if (window.innerWidth > 1080) {
- $("#chat-history").width("calc(100% - 331px)");
+ $("#chat-history").css("margin-right", "10px");
+ $("#chat-history").css("width", "calc(100% - 256px - 85px)");
} else {
// Make the menu invisible and move the content to the right.
$("#contact-menu").css("display", "none");
@@ -43,6 +45,7 @@ $(document).ready(function() {
// Add cookie so the menu stays open on other pages
if (window.innerWidth > 1080) {
+ $("#chat-history").css("margin-right", "266px");
$("#chat-history").width("calc(100% - 587px)");
document.cookie = "menu=open; path=/";
} else {
diff --git a/website/public/js/main.js b/website/public/js/main.js
index a5f17de..b6ab703 100644
--- a/website/public/js/main.js
+++ b/website/public/js/main.js
@@ -14,14 +14,14 @@ function fancyText(text) {
return "