Show More
@@ -46,15 +46,20 function resetFormPosition() { | |||
|
46 | 46 | } |
|
47 | 47 | |
|
48 | 48 | function addQuickReply(postId) { |
|
49 | var postLinkRaw = '[post]' + postId + '[/post]' | |
|
50 | ||
|
49 | 51 | var textToAdd = ''; |
|
50 | 52 | var blockToInsert = null; |
|
51 | 53 | |
|
54 | var textAreaJq = $('textarea'); | |
|
55 | ||
|
52 | 56 | if (postId != null) { |
|
53 | 57 | var post = $('#' + postId); |
|
54 | 58 | |
|
55 | // If this is not OP, add reflink to the post | |
|
56 | if (!post.is(':first-child')) { | |
|
57 | textToAdd += '[post]' + postId + '[/post]\n'; | |
|
59 | // If this is not OP, add reflink to the post. If there already is | |
|
60 | // the same reflink, don't add it again. | |
|
61 | if (!post.is(':first-child') && !textAreaJq.val().contains(postLinkRaw)) { | |
|
62 | textToAdd += postLinkRaw + '\n'; | |
|
58 | 63 | } |
|
59 | 64 | |
|
60 | 65 | blockToInsert = post; |
@@ -67,15 +72,14 function addQuickReply(postId) { | |||
|
67 | 72 | textToAdd += '[quote]' + selection + '[/quote]\n'; |
|
68 | 73 | } |
|
69 | 74 | |
|
70 | var textAreaId = 'textarea'; | |
|
71 | $(textAreaId).val($(textAreaId).val()+ textToAdd); | |
|
75 | textAreaJq.val(textAreaJq.val()+ textToAdd); | |
|
72 | 76 | |
|
73 | 77 | var form = getForm(); |
|
74 | 78 | form.insertAfter(blockToInsert); |
|
75 | 79 | form.show(); |
|
76 | 80 | |
|
81 | textAreaJq.focus(); | |
|
77 | 82 | var textarea = document.getElementsByTagName('textarea')[0]; |
|
78 | $(textAreaId).focus(); | |
|
79 | 83 | moveCaretToEnd(textarea); |
|
80 | 84 | } |
|
81 | 85 |
General Comments 0
You need to be logged in to leave comments.
Login now