|
1 | 1 | <script type="text/javascript"> |
2 | 2 | (function () { |
3 | | - // Show spacer div |
4 | 3 | $('#reply-control').on('show.bs.collapse', function () { |
| 4 | + // Show spacer div |
5 | 5 | $('#show-reply-form-when-visible').css({ |
6 | 6 | height: '{{#paginationRendered}}210{{/paginationRendered}}{{^paginationRendered}}268{{/paginationRendered}}px' |
7 | 7 | }); |
8 | 8 | }); |
9 | 9 |
|
10 | | - // Hide spacer div |
11 | 10 | $('#reply-control').on('hide.bs.collapse', function () { |
| 11 | + // Hide spacer div |
12 | 12 | $('#show-reply-form-when-visible').css({ |
13 | 13 | height: '0' |
14 | 14 | }); |
| 15 | + |
| 16 | + // Clear text value from reply box |
| 17 | + $('#reply-control textarea[name="comment-content"]').val(''); |
15 | 18 | }); |
16 | 19 |
|
17 | 20 | $('.btn-comment-reply').click(function (aE) { |
|
23 | 26 |
|
24 | 27 | document.location.hash = $comment.attr('id'); |
25 | 28 |
|
26 | | - var text = $replyTextarea.text(); |
27 | | - if (!/^\s*$/.test(text)) { |
28 | | - text += '\n\n'; // Add linebreak if reply already started. |
| 29 | + var value = $replyTextarea.val(); |
| 30 | + if (!/^\s*$/.test(value)) { |
| 31 | + value += '\n\n'; // Add linebreaks if reply already started. |
29 | 32 | } |
30 | | - text += '[Re](' + document.location.href.replace(/\(/g, '%28').replace(/\)/g, '%29') + '): '; |
31 | | - text += '[@' + $author.text() + '](' + $author.attr('href') + '): '; |
32 | | - text += ' \n'; |
33 | | - $replyTextarea.text(text); |
| 33 | + value += '[Re](' + document.location.href.replace(/\(/g, '%28').replace(/\)/g, '%29') + '): '; |
| 34 | + value += '[@' + $author.text() + '](' + $author.attr('href') + '): '; |
| 35 | + value += ' \n'; |
| 36 | + $replyTextarea.val(value); |
| 37 | + $replyTextarea.focus(); |
34 | 38 | }); |
35 | 39 |
|
36 | 40 | function isElementInViewport(aEl) { |
|
53 | 57 | if (!hasShownReplyForm) { |
54 | 58 | $('#reply-control').collapse('show'); |
55 | 59 | hasShownReplyForm = true; |
| 60 | + |
| 61 | + $('#reply-control textarea[name="comment-content"]').focus(); |
56 | 62 | } |
57 | 63 | } |
58 | 64 |
|
|
0 commit comments