Browse Source

report post delivery for direct messages and group chat. nice!

master
Miguel Freitas 10 years ago
parent
commit
cab3fe85b0
  1. 1
      home.html
  2. 25
      js/twister_formatpost.js

1
home.html

@ -444,6 +444,7 @@ @@ -444,6 +444,7 @@
<!-- cada li é uma mensagem -->
<li id="dm-chat-template" class="module post message">
<div class="post-photo"><img src="img/grayed_avatar_placeholder_24.png" alt="user-photo"/></div>
<span class="post-info-sent"></span>
<a href="#" class="post-info-time" title="08/10/13 às 18:00">10min</a>
<p class="post-text"></p>
</li>

25
js/twister_formatpost.js

@ -86,9 +86,7 @@ function postToElem( post, kind, promoted ) { @@ -86,9 +86,7 @@ function postToElem( post, kind, promoted ) {
postInfoName.text(n).attr('href', $.MAL.userUrl(n));
getFullname( n, postInfoName );
//elem.find('.post-info-tag').text("@" + n);
if( n === defaultScreenName ) {
setPostInfoSent(n,k,elem.find('.post-info-sent'));
}
setPostInfoSent(n,k,elem.find('.post-info-sent'));
getAvatar( n, elem.find('.avatar') );
elem.find('.post-info-time').text(timeGmtToText(t)).attr('title', timeSincePost(t));
@ -145,15 +143,17 @@ function postToElem( post, kind, promoted ) { @@ -145,15 +143,17 @@ function postToElem( post, kind, promoted ) {
}
function setPostInfoSent(n, k, item) {
getPostMaxAvailability(n,k,
function(args,count) {
if( count >= 3 ) { // assume 3 peers (me + 2) is enough for "sent"
args.item.text("\u2713"); // check mark
} else {
args.item.text("\u231B"); // hour glass
setTimeout(setPostInfoSent,2000,n,k,item);
}
}, {n:n,k:k,item:item});
if( n === defaultScreenName && k >= 0 ) {
getPostMaxAvailability(n,k,
function(args,count) {
if( count >= 3 ) { // assume 3 peers (me + 2) is enough for "sent"
args.item.text("\u2713"); // check mark
} else {
args.item.text("\u231B"); // hour glass
setTimeout(setPostInfoSent,2000,n,k,item);
}
}, {n:n,k:k,item:item});
}
}
// format dmdata (returned by getdirectmsgs) to display in "snippet" per user list
@ -189,6 +189,7 @@ function dmDataToConversationItem(dmData, localUser, remoteUser) { @@ -189,6 +189,7 @@ function dmDataToConversationItem(dmData, localUser, remoteUser) {
dmItem.addClass(classDm);
getAvatar(from, dmItem.find(".post-photo").find("img") );
dmItem.find(".post-info-time").text(timeGmtToText(dmData.time)).attr("title",timeSincePost(dmData.time));
setPostInfoSent(from,dmData.k,dmItem.find('.post-info-sent'));
var mentions = [];
dmItem.find('.post-text').html(htmlFormatMsg(dmData.text, mentions));

Loading…
Cancel
Save