@@ -15,12 +15,22 @@ jQuery(document).ready(function($) {
15
15
var parent = $ ( btn ) . parents ( '.MainContent' ) ;
16
16
var commentContainer = $ ( parent ) . find ( 'div.CommentForm' ) ;
17
17
var header = $ ( commentContainer ) . find ( 'h2.H' ) ;
18
- $ ( header ) . text ( 'Reply to a comment' ) ;
19
18
// Form
20
19
var form = $ ( commentContainer ) . find ( 'form#Form_Comment' ) ;
21
20
var href = $ ( btn ) . attr ( 'href' ) ;
22
21
var commentID = param ( href , 'ParentCommentID' ) ;
23
22
var hiddenField = $ ( form ) . find ( ':input[type="hidden"]#Form_ParentCommentID' )
23
+
24
+ var author = '' ;
25
+ if ( commentID == '' ) { // No Parent Comment, Reply to Discussion
26
+ commentID = 0 ;
27
+ author = $ ( btn ) . parents ( '.Discussion' ) . find ( '.Item-Header.DiscussionHeader .Author .topcoderHandle' ) . text ( ) ;
28
+ } else {
29
+ author = $ ( btn ) . parents ( '.Comment' ) . find ( '.Item-Header.CommentHeader .Author .topcoderHandle' ) . text ( ) ;
30
+ }
31
+
32
+ $ ( header ) . text ( 'Replying to ' + author ) ;
33
+
24
34
if ( $ ( hiddenField ) . length == 0 ) {
25
35
var el = '<input type="hidden" name="ParentCommentID" id="Form_ParentCommentID" value="' + commentID + '"></input>' ;
26
36
$ ( form ) . append ( el ) ;
@@ -30,11 +40,11 @@ jQuery(document).ready(function($) {
30
40
var formButtons = $ ( form ) . find ( '.Buttons' ) ;
31
41
var postCommentButton = $ ( form ) . find ( '.CommentButton' ) ;
32
42
postCommentButton . val ( 'Post Reply' ) ;
33
- var backButton = $ ( formButtons ) . find ( 'span.Back ' ) ;
43
+ var backButton = $ ( formButtons ) . find ( '.Button.PreviewButton ' ) ;
34
44
var cancelReplyButton = $ ( formButtons ) . find ( 'span.Reply' ) ;
35
45
if ( $ ( cancelReplyButton ) . length == 0 ) {
36
46
var cancelReplyButton = '<span class="Reply"><a href="/" class="Button CancelReplyComment">Cancel Reply</a></span>' ;
37
- $ ( cancelReplyButton ) . insertAfter ( backButton ) ;
47
+ $ ( cancelReplyButton ) . insertBefore ( backButton ) ;
38
48
} else {
39
49
$ ( cancelReplyButton ) . show ( ) ;
40
50
}
0 commit comments