diff --git a/home.html b/home.html index b96027f..437c819 100644 --- a/home.html +++ b/home.html @@ -309,6 +309,7 @@
diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index fe16ac0..df687f5 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -86,6 +86,9 @@ 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')); + } getAvatar( n, elem.find('.avatar') ); elem.find('.post-info-time').text(timeGmtToText(t)).attr('title', timeSincePost(t)); @@ -141,6 +144,18 @@ function postToElem( post, kind, promoted ) { return elem; } +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}); +} + // format dmdata (returned by getdirectmsgs) to display in "snippet" per user list function dmDataToSnippetItem(dmData, remoteUser) { var dmItem = $("#dm-snippet-template").clone(true); diff --git a/js/twister_io.js b/js/twister_io.js index 0680d5e..a5355bb 100644 --- a/js/twister_io.js +++ b/js/twister_io.js @@ -398,6 +398,15 @@ function getPostsCount( username, item ) { }, {username:username,item:item} ); } +function getPostMaxAvailability(username, k, cbFunc, cbArg) { + twisterRpc("getpiecemaxseen", [username,k], + function(args, ret) { + args.cbFunc(args.cbArg, ret); + }, {cbFunc:cbFunc, cbArg:cbArg}, + function(args, ret) { + console.log("getPostAvailability error"); + }, {cbFunc:cbFunc, cbArg:cbArg}); +} function checkPubkeyExists(username, cbFunc, cbArg) { // pubkey is checked in block chain db.