mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-09-19 17:46:33 +00:00
seen indicator
This commit is contained in:
parent
4a0e187b33
commit
28953d9576
@ -515,8 +515,9 @@ function sortMessagesByTime() {
|
||||
function addMessage(msg) {
|
||||
var escaped = $('<div>').text(msg.text).html();
|
||||
var textEl = $('<div class="text"></div>').html(autolinker.link(escaped));
|
||||
var seenHtml = msg.selfAuthored ? ' <span class="seen"><svg version="1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 40"><polygon fill="currentColor" points="40.6,12.1 17,35.7 7.4,26.1 4.6,29 17,41.3 43.4,14.9"/></svg></span>' : '';
|
||||
var msgContent = $(
|
||||
'<div class="msg-content"><div class="time"><span class="seen"><svg version="1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 40"><polygon fill="#4FC3F7" points="40.6,12.1 17,35.7 7.4,26.1 4.6,29 17,41.3 43.4,14.9"/></svg></span> ' + formatTime(msg.time) + '</div></div>'
|
||||
'<div class="msg-content"><div class="time">' + formatTime(msg.time) + seenHtml + '</div></div>'
|
||||
);
|
||||
msgContent.prepend(textEl);
|
||||
if (msg.text.length === 2 && isEmoji(msg.text)) {
|
||||
@ -600,7 +601,6 @@ function addChat(pub, chatLink) {
|
||||
});
|
||||
chats[pub].getMyMsgsLastSeenTime(time => {
|
||||
chats[pub].myLastSeenTime = new Date(time);
|
||||
console.log('myLastSeenTime', time);
|
||||
});
|
||||
}
|
||||
|
||||
@ -611,7 +611,7 @@ function lastSeenTimeChanged(pub) {
|
||||
$('.msg.our').each(function() {
|
||||
var el = $(this);
|
||||
if (el.data('time') <= chats[pub].theirLastSeenTime) {
|
||||
el.find('.seen').show();
|
||||
el.find('.seen').toggleClass('yes', true);
|
||||
}
|
||||
});
|
||||
// set seen msgs
|
||||
|
@ -156,10 +156,14 @@ header #back-button {
|
||||
}
|
||||
|
||||
.msg .seen {
|
||||
display: none;
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.msg .seen.yes {
|
||||
color: #4fc3f7;
|
||||
}
|
||||
|
||||
.msg .seen svg {
|
||||
width: 15px;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user