##// END OF EJS Templates
Quote many lines of one post
neko259 -
r1513:bf093d24 default
parent child Browse files
Show More
@@ -67,13 +67,29 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]'
70
71 var blockToInsert = null;
72
73
74 if (postId != null) {
75 var post = $('#' + postId);
76
77 blockToInsert = post;
78 } else {
79 blockToInsert = $('.thread');
80 }
81 showFormAfter(blockToInsert);
82 }
83 }
84
85 function addQuickQuote(postId) {
86 if (getForm().prev().attr('id') != postId) {
87 addQuickReply(postId);
88 }
71
89
72 var textToAdd = '';
90 var textToAdd = '';
73 var blockToInsert = null;
74
75 var textAreaJq = $('textarea');
91 var textAreaJq = $('textarea');
76
92 var postLinkRaw = '[post]' + postId + '[/post]'
77 if (postId != null) {
93 if (postId != null) {
78 var post = $('#' + postId);
94 var post = $('#' + postId);
79
95
@@ -82,12 +98,7 b' function addQuickReply(postId) {'
82 if (!post.is(':first-child') && textAreaJq.val().indexOf(postLinkRaw) < 0) {
98 if (!post.is(':first-child') && textAreaJq.val().indexOf(postLinkRaw) < 0) {
83 textToAdd += postLinkRaw + '\n';
99 textToAdd += postLinkRaw + '\n';
84 }
100 }
85
86 blockToInsert = post;
87 } else {
88 blockToInsert = $('.thread');
89 }
101 }
90
91 var selection = window.getSelection().toString();
102 var selection = window.getSelection().toString();
92 if (selection.length > 0) {
103 if (selection.length > 0) {
93 textToAdd += '[quote]' + selection + '[/quote]\n';
104 textToAdd += '[quote]' + selection + '[/quote]\n';
@@ -95,13 +106,10 b' function addQuickReply(postId) {'
95
106
96 textAreaJq.val(textAreaJq.val()+ textToAdd);
107 textAreaJq.val(textAreaJq.val()+ textToAdd);
97
108
98 showFormAfter(blockToInsert);
99
100 textAreaJq.focus();
109 textAreaJq.focus();
101 var textarea = document.getElementsByTagName('textarea')[0];
110 var textarea = document.getElementsByTagName('textarea')[0];
102 moveCaretToEnd(textarea);
111 moveCaretToEnd(textarea);
103 }
112 }
104 }
105
113
106 function scrollToBottom() {
114 function scrollToBottom() {
107 $html.animate({scrollTop: $html.height()}, "fast");
115 $html.animate({scrollTop: $html.height()}, "fast");
@@ -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