# HG changeset patch # User neko259 # Date 2016-05-04 10:24:35 # Node ID bf093d2460822fdd0e4892e49f3ba2ceb0209d3e # Parent 9178427eb3553fb7f09759fd2c455e0a5fb22a03 Quote many lines of one post 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,40 +67,48 @@ function addQuickReply(postId) { if (getForm().prev().attr('id') == postId) { resetFormPosition(); } else { - var postLinkRaw = '[post]' + postId + '[/post]' - var textToAdd = ''; var blockToInsert = null; - var textAreaJq = $('textarea'); 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'; - } - blockToInsert = post; } else { blockToInsert = $('.thread'); } + showFormAfter(blockToInsert); + } +} - var selection = window.getSelection().toString(); - if (selection.length > 0) { - textToAdd += '[quote]' + selection + '[/quote]\n'; - } +function addQuickQuote(postId) { + if (getForm().prev().attr('id') != postId) { + addQuickReply(postId); + } + + var textToAdd = ''; + var textAreaJq = $('textarea'); + var postLinkRaw = '[post]' + postId + '[/post]' + if (postId != null) { + var post = $('#' + postId); - textAreaJq.val(textAreaJq.val()+ textToAdd); - - showFormAfter(blockToInsert); + // 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'; + } - textAreaJq.focus(); - var textarea = document.getElementsByTagName('textarea')[0]; - moveCaretToEnd(textarea); - } + textAreaJq.val(textAreaJq.val()+ textToAdd); + + textAreaJq.focus(); + var textarea = document.getElementsByTagName('textarea')[0]; + moveCaretToEnd(textarea); } function scrollToBottom() { diff --git a/boards/templates/boards/post.html b/boards/templates/boards/post.html --- a/boards/templates/boards/post.html +++ b/boards/templates/boards/post.html @@ -42,7 +42,8 @@ {% endif %} {% endif %} {% if reply_link and not thread.is_archived %} - {% trans 'Reply' %} + {% trans 'Reply' %} | + {% trans 'Quote' %} {% endif %} {% if perms.boards.change_post or perms.boards.delete_post or perms.boards.change_thread or perms_boards.delete_thread %}