##// END OF EJS Templates
Fixed inserting post reflink upon "reply" button
neko259 -
r1516:13db88c3 default
parent child Browse files
Show More
@@ -67,13 +67,21 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
71 var blockToInsert = null;
70 var blockToInsert = null;
72
71 var textAreaJq = $('textarea');
72 var postLinkRaw = '[post]' + postId + '[/post]'
73 var textToAdd = '';
73
74
74 if (postId != null) {
75 if (postId != null) {
75 var post = $('#' + postId);
76 var post = $('#' + postId);
76
77
78 // If this is not OP, add reflink to the post. If there already is
79 // the same reflink, don't add it again.
80 if (!post.is(':first-child') && textAreaJq.val().indexOf(postLinkRaw) < 0) {
81 textToAdd += postLinkRaw + '\n';
82 }
83
84 textAreaJq.val(textAreaJq.val()+ textToAdd);
77 blockToInsert = post;
85 blockToInsert = post;
78 } else {
86 } else {
79 blockToInsert = $('.thread');
87 blockToInsert = $('.thread');
@@ -93,15 +101,6 b' function addQuickQuote(postId) {'
93 var textToAdd = '';
101 var textToAdd = '';
94 var textAreaJq = $('textarea');
102 var textAreaJq = $('textarea');
95 var postLinkRaw = '[post]' + postId + '[/post]'
103 var postLinkRaw = '[post]' + postId + '[/post]'
96 if (postId != null) {
97 var post = $('#' + postId);
98
99 // If this is not OP, add reflink to the post. If there already is
100 // the same reflink, don't add it again.
101 if (!post.is(':first-child') && textAreaJq.val().indexOf(postLinkRaw) < 0) {
102 textToAdd += postLinkRaw + '\n';
103 }
104 }
105 var selection = window.getSelection().toString();
104 var selection = window.getSelection().toString();
106 if (selection.length > 0) {
105 if (selection.length > 0) {
107 textToAdd += '[quote]' + selection + '[/quote]\n';
106 textToAdd += '[quote]' + selection + '[/quote]\n';
General Comments 0
You need to be logged in to leave comments. Login now