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

3
js/tmobile.js

@ -182,7 +182,8 @@ var router=new $.mobile.Router( @@ -182,7 +182,8 @@ var router=new $.mobile.Router(
// insert replies to this post after
requestRepliesAfter(originalLi);
// 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) {

23
js/twister_actions.js

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

Loading…
Cancel
Save