Show More
@@ -57,40 +57,35 b' function showFormAfter(blockToInsertAfte' | |||||
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 | function addQuickReply(postId) { |
|
59 | function addQuickReply(postId) { | |
60 | // If we click "reply" on the same post, it means "cancel" |
|
60 | var blockToInsert = null; | |
61 | if (getForm().prev().attr('id') == postId) { |
|
61 | var textAreaJq = getPostTextarea(); | |
62 | resetFormPosition(); |
|
62 | var postLinkRaw = '[post]' + postId + '[/post]' | |
63 | } else { |
|
63 | var textToAdd = ''; | |
64 | var blockToInsert = null; |
|
|||
65 | var textAreaJq = getPostTextarea(); |
|
|||
66 | var postLinkRaw = '[post]' + postId + '[/post]' |
|
|||
67 | var textToAdd = ''; |
|
|||
68 |
|
64 | |||
69 |
|
|
65 | if (postId != null) { | |
70 |
|
|
66 | var post = $('#' + postId); | |
71 |
|
67 | |||
72 |
|
|
68 | // If this is not OP, add reflink to the post. If there already is | |
73 |
|
|
69 | // the same reflink, don't add it again. | |
74 |
|
|
70 | var postText = textAreaJq.val(); | |
75 |
|
|
71 | if (!post.is(':first-child') && postText.indexOf(postLinkRaw) < 0) { | |
76 |
|
|
72 | // Insert line break if none is present. | |
77 |
|
|
73 | if (postText.length > 0 && !postText.endsWith('\n') && !postText.endsWith('\r')) { | |
78 |
|
|
74 | textToAdd += '\n'; | |
79 | } |
|
|||
80 | textToAdd += postLinkRaw + '\n'; |
|
|||
81 | } |
|
75 | } | |
|
76 | textToAdd += postLinkRaw + '\n'; | |||
|
77 | } | |||
82 |
|
78 | |||
83 |
|
|
79 | textAreaJq.val(textAreaJq.val()+ textToAdd); | |
84 |
|
|
80 | blockToInsert = post; | |
85 |
|
|
81 | } else { | |
86 |
|
|
82 | blockToInsert = $('.thread'); | |
87 |
|
|
83 | } | |
88 |
|
|
84 | showFormAfter(blockToInsert); | |
89 |
|
||||
90 | textAreaJq.focus(); |
|
|||
91 |
|
85 | |||
92 | moveCaretToEnd(textAreaJq); |
|
86 | textAreaJq.focus(); | |
93 | } |
|
87 | ||
|
88 | moveCaretToEnd(textAreaJq); | |||
94 | } |
|
89 | } | |
95 |
|
90 | |||
96 | function addQuickQuote() { |
|
91 | function addQuickQuote() { | |
@@ -98,7 +93,7 b' function addQuickQuote() {' | |||||
98 |
|
93 | |||
99 | var quoteButton = $("#quote-button"); |
|
94 | var quoteButton = $("#quote-button"); | |
100 | var postId = quoteButton.attr('data-post-id'); |
|
95 | var postId = quoteButton.attr('data-post-id'); | |
101 | if (postId != null && getForm().prev().attr('id') != postId) { |
|
96 | if (postId != null) { | |
102 | addQuickReply(postId); |
|
97 | addQuickReply(postId); | |
103 | } |
|
98 | } | |
104 |
|
99 |
General Comments 0
You need to be logged in to leave comments.
Login now