Ticket #7635: 7635.6.patch

File 7635.6.patch, 2.7 KB (added by azaozz, 5 years ago)
  • wp-includes/comment-template.php

     
    924924 * @param string $respond_id Optional. HTML ID attribute for JS cancelCommentReply function. 
    925925 * @param string $respond_root Optional. Second parameter for JS cancelCommentReply function. 
    926926 */ 
    927 function cancel_comment_reply_link($text = '', $respond_id = 'respond', $respond_root = 'content') { 
     927function cancel_comment_reply_link($text = '', $id = 'cancel-comment-reply-link', $hide = true) { 
    928928        if ( empty($text) ) 
    929929                $text = __('Click here to cancel reply.'); 
    930         echo '<a href="#" onclick="cancelCommentReply(\'' . $respond_id . '\', \'' . $respond_root . '\'); return false;">' . $text . '</a>'; 
     930        $s = $hide ? ' style="display:none;"' : ''; 
     931        echo '<a href="#" id="' . $id . '"' . $s . '>' . $text . '</a>'; 
    931932} 
    932933 
    933934/** 
     
    10461047 
    10471048                <?php echo apply_filters('comment_text', get_comment_text()) ?> 
    10481049 
    1049                 <div class="reply" style="display:none"> 
     1050                <div class="wp-comment-reply" style="display:none"> 
    10501051                <?php echo comment_reply_link(array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['depth'])) ?> 
    10511052                <?php if ( 'ul' == $args['style'] ) : ?> 
    10521053                </div> 
  • wp-includes/js/comment-reply.js

     
    1 function moveAddCommentForm(theId,threadId,respondId){ 
    2         jQuery("#"+respondId).appendTo("#"+theId); 
    3         jQuery("#comment-parent").val(threadId); 
    4         jQuery("#cancel-comment-reply").show(); 
    5         jQuery("#comment").focus(); 
    6 } 
    7 function cancelCommentReply(respondId,respondRoot){ 
    8         jQuery("#cancel-comment-reply").hide(); 
    9         jQuery("#"+respondId).appendTo("#"+respondRoot); 
    10         document.location.href="#respond"; 
    11         jQuery("#comment").focus(); 
    12         jQuery("#comment-parent").val("0"); 
    13 } 
    14 jQuery(document).ready(function($){ 
    15         $(".thread-odd").find("div.reply").show(); 
    16         $(".thread-even").find("div.reply").show(); 
    17 }); 
     1var moveAddCommentForm; 
     2 
     3(function($){ 
     4        moveAddCommentForm = function(theId,threadId,respondId){ 
     5                var div = document.createElement('div'); 
     6                $("#"+respondId).before( $(div).attr('id', 'wp-temp-form-div').hide() ).appendTo("#"+theId); 
     7                $("#comment-parent").val(threadId); 
     8                $("#cancel-comment-reply-link").show().click(function(){ 
     9                        $("#comment-parent").val("0"); 
     10                        $('#wp-temp-form-div').after( $("#"+respondId) ).remove(); 
     11                        $(this).hide(); 
     12                        return false; 
     13                }); 
     14                $("#comment").focus(); 
     15        } 
     16 
     17        $(document).ready(function(){ 
     18                $("div.wp-comment-reply").show(); 
     19        }); 
     20})(jQuery)