mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-01-13 16:37:52 +00:00
add updating of retwisters info of an expanded twist after retwist
This commit is contained in:
parent
e4778b9342
commit
f0d81c70ed
@ -2462,7 +2462,8 @@ function postSubmit(e, oldLastPostId) {
|
|||||||
if (btnPostSubmit.hasClass('with-reference')) {
|
if (btnPostSubmit.hasClass('with-reference')) {
|
||||||
var doSubmitPost = function (postText, postDataElem) {
|
var doSubmitPost = function (postText, postDataElem) {
|
||||||
newRtMsg($.evalJSON(postDataElem.attr('data-content_to_rt')),
|
newRtMsg($.evalJSON(postDataElem.attr('data-content_to_rt')),
|
||||||
postDataElem.attr('data-content_to_sigrt'), postText);
|
postDataElem.attr('data-content_to_sigrt'), postText, updateRTsWithOwnOne
|
||||||
|
);
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (splitedPostsCount > 1) {
|
if (splitedPostsCount > 1) {
|
||||||
@ -2587,7 +2588,8 @@ function retweetSubmit(event) {
|
|||||||
var postDataElem = prompt.find('.post-data');
|
var postDataElem = prompt.find('.post-data');
|
||||||
|
|
||||||
newRtMsg($.evalJSON(postDataElem.attr('data-content_to_rt')),
|
newRtMsg($.evalJSON(postDataElem.attr('data-content_to_rt')),
|
||||||
postDataElem.attr('data-content_to_sigrt'));
|
postDataElem.attr('data-content_to_sigrt'), '', updateRTsWithOwnOne
|
||||||
|
);
|
||||||
|
|
||||||
closePrompt(prompt);
|
closePrompt(prompt);
|
||||||
}
|
}
|
||||||
|
@ -145,8 +145,49 @@ function requestRTs(postDataElem) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateRTsWithOwnOne(req, ret) {
|
||||||
|
if (!ret || !ret.userpost || !ret.userpost.rt || !ret.userpost.rt.n || !ret.userpost.rt.k)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var postDataElem = getElem('.expanded-post .post-data'
|
||||||
|
+ '[data-screen-name=\'' + ret.userpost.rt.n + '\']'
|
||||||
|
+ '[data-id=\'' + ret.userpost.rt.k + '\']');
|
||||||
|
|
||||||
|
for (var i = 0; i < postDataElem.length; i++) {
|
||||||
|
var postStatsElem = postDataElem.eq(i).find('.post-stats');
|
||||||
|
var statCountValueElem = postStatsElem.find('.stat-count-value');
|
||||||
|
|
||||||
|
var avatarRowElem = postStatsElem.find('.avatar-row');
|
||||||
|
|
||||||
|
var ownAvatarElem = avatarRowElem.find('[data-peer-alias="' + defaultScreenName + '"]');
|
||||||
|
if (ownAvatarElem.length) {
|
||||||
|
if (avatarRowElem.children().length > 1)
|
||||||
|
ownAvatarElem.prependTo(avatarRowElem);
|
||||||
|
|
||||||
|
statCountValueElem.text(parseInt(statCountValueElem.text()) + 1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
appendPeerAvatarToRTsRowElem(defaultScreenName, avatarRowElem);
|
||||||
|
|
||||||
|
if (avatarRowElem.children().length === 1) {
|
||||||
|
statCountValueElem.text('1');
|
||||||
|
postStatsElem.slideDown('fast');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
statCountValueElem.text(parseInt(statCountValueElem.text()) + 1);
|
||||||
|
|
||||||
|
avatarRowElem.children().last().prependTo(avatarRowElem);
|
||||||
|
|
||||||
|
if (avatarRowElem.children().length > 12)
|
||||||
|
avatarRowElem.children().eq(12).remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function appendPeerAvatarToRTsRowElem(peerAlias, rowElem) {
|
function appendPeerAvatarToRTsRowElem(peerAlias, rowElem) {
|
||||||
var elem = twister.tmpl.avatarTiny.clone(true)
|
var elem = twister.tmpl.avatarTiny.clone(true)
|
||||||
|
.attr('data-peer-alias', peerAlias)
|
||||||
.attr('href', $.MAL.userUrl(peerAlias))
|
.attr('href', $.MAL.userUrl(peerAlias))
|
||||||
.appendTo(rowElem)
|
.appendTo(rowElem)
|
||||||
;
|
;
|
||||||
|
Loading…
Reference in New Issue
Block a user