From e556351906afdeb86cea6435c57cf8bffc9ff56b Mon Sep 17 00:00:00 2001 From: Hannes Mannerheim Date: Sat, 21 Mar 2015 17:16:09 +0100 Subject: [PATCH] fix for #142 --- js/qvitter.js | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/js/qvitter.js b/js/qvitter.js index 670379f..cf5080a 100644 --- a/js/qvitter.js +++ b/js/qvitter.js @@ -1720,34 +1720,26 @@ $('body').on('click', '.queet-toolbar button',function () { // remove any popups $('.modal-container').remove(); - // try to find a queet to add the temp queet to - if($('.stream-item.replying-to').length > 0) { - // if the queet is in conversation, add it to parent's conversation - if($('.stream-item.replying-to').hasClass('conversation')) { - $('.stream-item.replying-to').parent().append(queetHtml); - } - else { - // if the queet is expanded, add it to its conversation - if($('.stream-item.replying-to').hasClass('expanded')) { - $('.stream-item.replying-to').append(queetHtml); - } - // it it's not expanded, add it to top - else { - $('#feed-body').prepend(queetHtml.replace('class="stream-item conversation','class="stream-item')); - } - } - $('.stream-item').removeClass('replying-to'); + // try to find a queet to add the temp queet to: + + // if the queet is in conversation, add it to parent's conversation + if($('.stream-item.replying-to').length > 0 && $('.stream-item.replying-to').hasClass('conversation')) { + $('.stream-item.replying-to').parent().append(queetHtml); } + // if the queet is expanded, add it to its conversation + else if($('.stream-item.replying-to').length > 0 && $('.stream-item.replying-to').hasClass('expanded')) { + $('.stream-item.replying-to').append(queetHtml); + } + // maybe the replying-to class is missing but we still have a suiting place to add it else if($('.stream-item.expanded[data-quitter-id="' + in_reply_to_status_id + '"]').length > 0) { $('.stream-item.expanded[data-quitter-id="' + in_reply_to_status_id + '"]').append(queetHtml); } - // if we cant find a proper place, add it to top and remove conversation class - // but only if this is either 1) our home/all feed, 2) our user timeline or 3) whole site or 4) whole network + // if we can't find a proper place, add it to top and remove conversation class + // if this is either 1) our home/all feed, 2) our user timeline or 3) whole site or 4) whole network else if(window.currentStream.indexOf('statuses/friends_timeline.json') > -1 || window.currentStream.indexOf('statuses/user_timeline.json?screen_name=' + window.loggedIn.screen_name) > -1 || window.currentStream.indexOf('statuses/public_timeline.json') > -1 - || window.currentStream.indexOf('statuses/public_and_external_timeline.json') > -1 - ) { + || window.currentStream.indexOf('statuses/public_and_external_timeline.json') > -1 ) { $('#feed-body').prepend(queetHtml.replace('class="stream-item conversation','class="stream-item')); } // don't add it to the current stream, open a popup instead, without conversation class @@ -1755,6 +1747,9 @@ $('body').on('click', '.queet-toolbar button',function () { popUpAction('popup-sending', '',queetHtml.replace('class="stream-item conversation','class="stream-item'),false); } + // remove any replying-to classes + $('.stream-item').removeClass('replying-to'); + // null reply box collapseQueetBox(queetBox)