##// END OF EJS Templates
Quote many lines of one post
neko259 -
r1513:bf093d24 default
parent child Browse files
Show More
@@ -67,40 +67,48 b' function addQuickReply(postId) {'
67 if (getForm().prev().attr('id') == postId) {
67 if (getForm().prev().attr('id') == postId) {
68 resetFormPosition();
68 resetFormPosition();
69 } else {
69 } else {
70 var postLinkRaw = '[post]' + postId + '[/post]'
71
70
72 var textToAdd = '';
73 var blockToInsert = null;
71 var blockToInsert = null;
74
72
75 var textAreaJq = $('textarea');
76
73
77 if (postId != null) {
74 if (postId != null) {
78 var post = $('#' + postId);
75 var post = $('#' + postId);
79
76
80 // If this is not OP, add reflink to the post. If there already is
81 // the same reflink, don't add it again.
82 if (!post.is(':first-child') && textAreaJq.val().indexOf(postLinkRaw) < 0) {
83 textToAdd += postLinkRaw + '\n';
84 }
85
86 blockToInsert = post;
77 blockToInsert = post;
87 } else {
78 } else {
88 blockToInsert = $('.thread');
79 blockToInsert = $('.thread');
89 }
80 }
81 showFormAfter(blockToInsert);
82 }
83 }
90
84
91 var selection = window.getSelection().toString();
85 function addQuickQuote(postId) {
92 if (selection.length > 0) {
86 if (getForm().prev().attr('id') != postId) {
93 textToAdd += '[quote]' + selection + '[/quote]\n';
87 addQuickReply(postId);
94 }
88 }
89
90 var textToAdd = '';
91 var textAreaJq = $('textarea');
92 var postLinkRaw = '[post]' + postId + '[/post]'
93 if (postId != null) {
94 var post = $('#' + postId);
95
95
96 textAreaJq.val(textAreaJq.val()+ textToAdd);
96 // If this is not OP, add reflink to the post. If there already is
97
97 // the same reflink, don't add it again.
98 showFormAfter(blockToInsert);
98 if (!post.is(':first-child') && textAreaJq.val().indexOf(postLinkRaw) < 0) {
99 textToAdd += postLinkRaw + '\n';
100 }
101 }
102 var selection = window.getSelection().toString();
103 if (selection.length > 0) {
104 textToAdd += '[quote]' + selection + '[/quote]\n';
105 }
99
106
100 textAreaJq.focus();
107 textAreaJq.val(textAreaJq.val()+ textToAdd);
101 var textarea = document.getElementsByTagName('textarea')[0];
108
102 moveCaretToEnd(textarea);
109 textAreaJq.focus();
103 }
110 var textarea = document.getElementsByTagName('textarea')[0];
111 moveCaretToEnd(textarea);
104 }
112 }
105
113
106 function scrollToBottom() {
114 function scrollToBottom() {
@@ -42,7 +42,8 b''
42 {% endif %}
42 {% endif %}
43 {% endif %}
43 {% endif %}
44 {% if reply_link and not thread.is_archived %}
44 {% if reply_link and not thread.is_archived %}
45 <a href="#form" onclick="addQuickReply('{{ post.id }}'); return false;">{% trans 'Reply' %}</a>
45 <a href="#form" onclick="addQuickReply('{{ post.id }}'); return false;">{% trans 'Reply' %}</a> |
46 <a href="#form" onclick="addQuickQuote('{{ post.id }}'); return false;">{% trans 'Quote' %}</a>
46 {% endif %}
47 {% endif %}
47
48
48 {% if perms.boards.change_post or perms.boards.delete_post or perms.boards.change_thread or perms_boards.delete_thread %}
49 {% if perms.boards.change_post or perms.boards.delete_post or perms.boards.change_thread or perms_boards.delete_thread %}
General Comments 0
You need to be logged in to leave comments. Login now