diff --git a/js/interface_common.js b/js/interface_common.js index b86ed69..e6fbc39 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -2467,13 +2467,47 @@ function postSubmit(e, oldLastPostId) { if (splitedPostsCount > 1) { if (textArea.length < splitedPostsCount) { //current part will be sent as reply to the previous part... - postData = $('
'); + postData = $(''); } } - var doSubmitPost = function (postText, postData) { - newPostMsg(postText, postData.attr('data-screen-name'), parseInt(postData.attr('data-id'))); - } + if (postData.length) + var doSubmitPost = function (postText, postDataElem) { + var reply_n = postDataElem.attr('data-screen-name'); + var reply_k = parseInt(postDataElem.attr('data-id')); + var part_id = postDataElem.attr('data-reply-part-id'); + var cbFunc = function (req, ret) { + var postDataElem = $('.expanded-post .post-data' + + '[data-screen-name=\'' + req.reply_n + '\']' + + '[data-id=\'' + req.reply_k + '\']'); + + if (!postDataElem.length) { + if (req.part_id && ++req.tries < 5) + setTimeout(req.cbFunc, 2000, req); + return; + } + + formerPostElem = postDataElem.closest('li.post'); + if (!formerPostElem.next().is('.post-replies')) + formerPostElem.after($('