Browse Source

add update retwisters info for all copies of an expanded twist after request of an DHT call in requestRTs()

readme-update
Simon Grim 6 years ago
parent
commit
36fa887d4c
  1. 3
      js/interface_common.js
  2. 3
      js/tmobile.js
  3. 23
      js/twister_actions.js

3
js/interface_common.js

@ -1702,7 +1702,7 @@ function postExpandFunction(e, postLi) {
// insert replies to this post after // insert replies to this post after
requestRepliesAfter(originalLi); requestRepliesAfter(originalLi);
// RTs faces and counter // RTs faces and counter
requestRTs(originalPost); requestRTs(originalPost.attr('data-screen-name'), originalPost.attr('data-id'));
} else { } else {
postLi.removeClass(openClass); postLi.removeClass(openClass);
@ -2791,6 +2791,7 @@ function initInterfaceCommon() {
.removeClass('pending').slideDown('fast') .removeClass('pending').slideDown('fast')
; ;
}) })
.closest('.post-data').find('.post-stats').hide()
; ;
$('.post-area-new') $('.post-area-new')
.on('click', function(e) {composeNewPost(e, $(this));}) .on('click', function(e) {composeNewPost(e, $(this));})

3
js/tmobile.js

@ -182,7 +182,8 @@ var router=new $.mobile.Router(
// insert replies to this post after // insert replies to this post after
requestRepliesAfter(originalLi); requestRepliesAfter(originalLi);
// RTs faces and counter // RTs faces and counter
requestRTs(originalLi.find('.post-data')); var postDataElem = originalLi.find('.post-data');
requestRTs(postDataElem.attr('data-screen-name'), postDataElem.attr('data-id'));
}); });
}, },
newmsg: function(type,match,ui) { newmsg: function(type,match,ui) {

23
js/twister_actions.js

@ -120,10 +120,7 @@ function requestRepliesAfterAll(postLi)
} }
} }
function requestRTs(postDataElem) { function requestRTs(post_n, post_k) {
var post_n = postDataElem.attr('data-screen-name');
var post_k = postDataElem.attr('data-id');
if (!post_n || !post_k) if (!post_n || !post_k)
return; return;
@ -132,9 +129,17 @@ function requestRTs(postDataElem) {
if (!ret.length) if (!ret.length)
return; return;
req.find('.stat-count-value').text(ret.length); var postDataElem = getElem('.expanded-post .post-data'
+ '[data-screen-name=\'' + req.post_n + '\']'
+ '[data-id=\'' + req.post_k + '\']');
if (!postDataElem.length)
return;
var postStatsElem = postDataElem.find('.post-stats');
postStatsElem.find('.stat-count-value').text(ret.length);
var avatarRowElem = req.find('.avatar-row').empty(); var avatarRowElem = postStatsElem.find('.avatar-row').empty();
var avatarsAppended = []; var avatarsAppended = [];
for (var i = 0; i < ret.length && i < 12; i++) { for (var i = 0; i < ret.length && i < 12; i++) {
if (avatarsAppended.indexOf(ret[i].userpost.n) !== -1) if (avatarsAppended.indexOf(ret[i].userpost.n) !== -1)
@ -144,10 +149,10 @@ function requestRTs(postDataElem) {
appendPeerAvatarToRTsRowElem(ret[i].userpost.n, avatarRowElem); appendPeerAvatarToRTsRowElem(ret[i].userpost.n, avatarRowElem);
} }
if (avatarRowElem.children().length) if (avatarsAppended.length)
req.slideDown('fast'); postStatsElem.slideDown('fast');
}, },
postDataElem.find('.post-stats').hide() {post_n: post_n, post_k: post_k}
); );
} }

Loading…
Cancel
Save