Merge branch 'lars' into 'master'
Lars See merge request !142
This commit was merged in pull request #146.
This commit is contained in:
@@ -42,7 +42,6 @@ function addMessages(messages) {
|
||||
type = "chat-message-other";
|
||||
}
|
||||
if (thisDate > previousDate) {
|
||||
console.log(previousDate);
|
||||
previousDate = thisDate;
|
||||
$("#chat-history").append('\
|
||||
<div class="day-message"> \
|
||||
@@ -55,7 +54,7 @@ function addMessages(messages) {
|
||||
$("#chat-history").append('\
|
||||
<div class="chat-message"> \
|
||||
<div class="' + type + '">\
|
||||
' + messages[i].content + '\
|
||||
' + fancyText(messages[i].content) + '\
|
||||
</div> \
|
||||
</div>\
|
||||
');
|
||||
@@ -63,6 +62,7 @@ function addMessages(messages) {
|
||||
}
|
||||
|
||||
function switchUser(userID) {
|
||||
previousDate = new Date("1970-01-01 00:00:00");
|
||||
$(".chat-field").show();
|
||||
$(".destinationID").val(userID);
|
||||
$("#chat-history").html("");
|
||||
|
||||
@@ -1,6 +1,23 @@
|
||||
var days = ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"];
|
||||
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) {
|
||||
cookies = document.cookie.split("; ");
|
||||
for (var i in cookies) {
|
||||
|
||||
@@ -126,4 +126,8 @@ body {
|
||||
.active-friend-chat {
|
||||
background: #4CAF50;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.chat-message img {
|
||||
max-width: 100%;
|
||||
}
|
||||
Reference in New Issue
Block a user