diff --git a/boards/static/js/thread.js b/boards/static/js/thread.js --- a/boards/static/js/thread.js +++ b/boards/static/js/thread.js @@ -67,13 +67,21 @@ function addQuickReply(postId) { if (getForm().prev().attr('id') == postId) { resetFormPosition(); } else { - var blockToInsert = null; - + var textAreaJq = $('textarea'); + var postLinkRaw = '[post]' + postId + '[/post]' + var textToAdd = ''; if (postId != null) { var post = $('#' + postId); + // If this is not OP, add reflink to the post. If there already is + // the same reflink, don't add it again. + if (!post.is(':first-child') && textAreaJq.val().indexOf(postLinkRaw) < 0) { + textToAdd += postLinkRaw + '\n'; + } + + textAreaJq.val(textAreaJq.val()+ textToAdd); blockToInsert = post; } else { blockToInsert = $('.thread'); @@ -93,15 +101,6 @@ function addQuickQuote(postId) { var textToAdd = ''; var textAreaJq = $('textarea'); var postLinkRaw = '[post]' + postId + '[/post]' - if (postId != null) { - var post = $('#' + postId); - - // If this is not OP, add reflink to the post. If there already is - // the same reflink, don't add it again. - if (!post.is(':first-child') && textAreaJq.val().indexOf(postLinkRaw) < 0) { - textToAdd += postLinkRaw + '\n'; - } - } var selection = window.getSelection().toString(); if (selection.length > 0) { textToAdd += '[quote]' + selection + '[/quote]\n';