Chat post images
This commit is contained in:
@@ -42,7 +42,6 @@ function addMessages(messages) {
|
|||||||
type = "chat-message-other";
|
type = "chat-message-other";
|
||||||
}
|
}
|
||||||
if (thisDate > previousDate) {
|
if (thisDate > previousDate) {
|
||||||
console.log(previousDate);
|
|
||||||
previousDate = thisDate;
|
previousDate = thisDate;
|
||||||
$("#chat-history").append('\
|
$("#chat-history").append('\
|
||||||
<div class="day-message"> \
|
<div class="day-message"> \
|
||||||
@@ -55,7 +54,7 @@ function addMessages(messages) {
|
|||||||
$("#chat-history").append('\
|
$("#chat-history").append('\
|
||||||
<div class="chat-message"> \
|
<div class="chat-message"> \
|
||||||
<div class="' + type + '">\
|
<div class="' + type + '">\
|
||||||
' + messages[i].content + '\
|
' + fancyText(messages[i].content) + '\
|
||||||
</div> \
|
</div> \
|
||||||
</div>\
|
</div>\
|
||||||
');
|
');
|
||||||
@@ -63,6 +62,7 @@ function addMessages(messages) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function switchUser(userID) {
|
function switchUser(userID) {
|
||||||
|
previousDate = new Date("1970-01-01 00:00:00");
|
||||||
$(".chat-field").show();
|
$(".chat-field").show();
|
||||||
$(".destinationID").val(userID);
|
$(".destinationID").val(userID);
|
||||||
$("#chat-history").html("");
|
$("#chat-history").html("");
|
||||||
|
|||||||
@@ -1,6 +1,23 @@
|
|||||||
var days = ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"];
|
var days = ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"];
|
||||||
var months = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"]
|
var months = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"]
|
||||||
|
|
||||||
|
function fancyText(text) {
|
||||||
|
|
||||||
|
// Add images and gifs.
|
||||||
|
var regex = /(https:\/\/.[^ ]*\.(?:png|jpg|jpeg|gif))/ig;
|
||||||
|
text = text.replace(regex, function(img) {
|
||||||
|
return "<img src='" + img + "' />";
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add links.
|
||||||
|
// regex = /(https:\/\/.[^ ]*\.(?:net|com|nl))/ig;
|
||||||
|
// text = text.replace(regex, function(link) {
|
||||||
|
// return "<a href='" + link + "'>LINK</a>";
|
||||||
|
// });
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
function getCookie(key) {
|
function getCookie(key) {
|
||||||
cookies = document.cookie.split("; ");
|
cookies = document.cookie.split("; ");
|
||||||
for (var i in cookies) {
|
for (var i in cookies) {
|
||||||
|
|||||||
@@ -126,4 +126,8 @@ body {
|
|||||||
.active-friend-chat {
|
.active-friend-chat {
|
||||||
background: #4CAF50;
|
background: #4CAF50;
|
||||||
color: white;
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-message img {
|
||||||
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user