Show More
@@ -67,40 +67,48 b' function addQuickReply(postId) {' | |||
|
67 | 67 | if (getForm().prev().attr('id') == postId) { |
|
68 | 68 | resetFormPosition(); |
|
69 | 69 | } else { |
|
70 | var postLinkRaw = '[post]' + postId + '[/post]' | |
|
71 | 70 | |
|
72 | var textToAdd = ''; | |
|
73 | 71 | var blockToInsert = null; |
|
74 | 72 | |
|
75 | var textAreaJq = $('textarea'); | |
|
76 | 73 | |
|
77 | 74 | if (postId != null) { |
|
78 | 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 | 77 | blockToInsert = post; |
|
87 | 78 | } else { |
|
88 | 79 | blockToInsert = $('.thread'); |
|
89 | 80 | } |
|
81 | showFormAfter(blockToInsert); | |
|
82 | } | |
|
83 | } | |
|
90 | 84 | |
|
91 | var selection = window.getSelection().toString(); | |
|
92 | if (selection.length > 0) { | |
|
93 | textToAdd += '[quote]' + selection + '[/quote]\n'; | |
|
94 |
|
|
|
85 | function addQuickQuote(postId) { | |
|
86 | if (getForm().prev().attr('id') != postId) { | |
|
87 | addQuickReply(postId); | |
|
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); | |
|
97 | ||
|
98 | showFormAfter(blockToInsert); | |
|
96 | // If this is not OP, add reflink to the post. If there already is | |
|
97 | // the same reflink, don't add it again. | |
|
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(); | |
|
101 | var textarea = document.getElementsByTagName('textarea')[0]; | |
|
102 | moveCaretToEnd(textarea); | |
|
103 | } | |
|
107 | textAreaJq.val(textAreaJq.val()+ textToAdd); | |
|
108 | ||
|
109 | textAreaJq.focus(); | |
|
110 | var textarea = document.getElementsByTagName('textarea')[0]; | |
|
111 | moveCaretToEnd(textarea); | |
|
104 | 112 | } |
|
105 | 113 | |
|
106 | 114 | function scrollToBottom() { |
@@ -42,7 +42,8 b'' | |||
|
42 | 42 | {% endif %} |
|
43 | 43 | {% endif %} |
|
44 | 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 | 47 | {% endif %} |
|
47 | 48 | |
|
48 | 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