Chat messages split per day
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
var previousDate = new Date("1970-01-01 00:00:00");
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
loadMessages();
|
loadMessages();
|
||||||
sayEmpty();
|
sayEmpty();
|
||||||
@@ -31,13 +33,25 @@ function sendMessage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addMessages(messages) {
|
function addMessages(messages) {
|
||||||
for(i in messages) {
|
for(var i in messages) {
|
||||||
|
thisDate = new Date(messages[i].creationdate);
|
||||||
|
thisDate.setHours(0,0,0,0);
|
||||||
if (messages[i].destination == $(".destinationID").val()) {
|
if (messages[i].destination == $(".destinationID").val()) {
|
||||||
type = "chat-message-self";
|
type = "chat-message-self";
|
||||||
} else {
|
} else {
|
||||||
type = "chat-message-other";
|
type = "chat-message-other";
|
||||||
}
|
}
|
||||||
|
if (thisDate > previousDate) {
|
||||||
|
console.log(previousDate);
|
||||||
|
previousDate = thisDate;
|
||||||
|
$("#chat-history").append('\
|
||||||
|
<div class="day-message"> \
|
||||||
|
<div class="day-message-content">\
|
||||||
|
' + days[thisDate.getDay()] + " " + thisDate.getDate() + " " + months[thisDate.getMonth()] + " " + thisDate.getFullYear() + '\
|
||||||
|
</div> \
|
||||||
|
</div>\
|
||||||
|
');
|
||||||
|
}
|
||||||
$("#chat-history").append('\
|
$("#chat-history").append('\
|
||||||
<div class="chat-message"> \
|
<div class="chat-message"> \
|
||||||
<div class="' + type + '">\
|
<div class="' + type + '">\
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
var days = ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"];
|
||||||
|
var months = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"]
|
||||||
|
|
||||||
function getCookie(key) {
|
function getCookie(key) {
|
||||||
cookies = document.cookie.split("; ");
|
cookies = document.cookie.split("; ");
|
||||||
for (var i in cookies) {
|
for (var i in cookies) {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ function searchUsers(n, m) {
|
|||||||
filter: $("#search-filter").val()
|
filter: $("#search-filter").val()
|
||||||
}
|
}
|
||||||
).done(function(data) {
|
).done(function(data) {
|
||||||
console.log(data);
|
|
||||||
if (!showFriends(data, "#search-users-list", 0, "profile.php", "GET")) {
|
if (!showFriends(data, "#search-users-list", 0, "profile.php", "GET")) {
|
||||||
$("#search-users-list").text("Niemand gevonden");
|
$("#search-users-list").text("Niemand gevonden");
|
||||||
}
|
}
|
||||||
@@ -25,7 +24,6 @@ function searchGroups(n, m) {
|
|||||||
filter: $("#search-filter").val()
|
filter: $("#search-filter").val()
|
||||||
}
|
}
|
||||||
).done(function(data) {
|
).done(function(data) {
|
||||||
console.log(data);
|
|
||||||
if (!showGroups(data, "#search-groups-list")) {
|
if (!showGroups(data, "#search-groups-list")) {
|
||||||
$("#search-groups-list").text("Geen groepen gevonden");
|
$("#search-groups-list").text("Geen groepen gevonden");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
|
||||||
|
body {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
/* Overall chat-screen */
|
/* Overall chat-screen */
|
||||||
.chat {
|
.chat {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@@ -37,6 +42,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Chat-message takes the whole width of the chat area */
|
/* Chat-message takes the whole width of the chat area */
|
||||||
|
.day-message {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 40px;
|
||||||
|
padding: 10px 0;
|
||||||
|
clear: both;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.day-message-content {
|
||||||
|
width: auto;
|
||||||
|
padding: 10px;
|
||||||
|
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
.chat-message {
|
.chat-message {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
|
|||||||
Reference in New Issue
Block a user