Make WordPress Core

Ticket #7552: show-threaded-reply-via-js.diff

File show-threaded-reply-via-js.diff, 1.6 KB (added by Viper007Bond, 16 years ago)

Dunno if best solution or not, but here's my try (onload sucks)

  • wp-includes/comment-template.php

     
    10371037
    10381038                <?php echo apply_filters('comment_text', get_comment_text()) ?>
    10391039
    1040                 <div class='reply'>
     1040                <div class="reply" style="display:none">
    10411041                <?php echo comment_reply_link(array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['depth'])) ?>
    10421042                <?php if ( 'ul' == $args['style'] ) : ?>
    10431043                </div>
     
    11421142                $walker->paged_walk($comments, $depth, $page, $per_page, $r);
    11431143                $wp_query->max_num_comment_pages = $walker->max_pages;
    11441144        }
     1145
     1146        // Show "Reply" links
     1147        echo "<script type='text/javascript'>if ( typeof showCommentReplyLinks != 'undefined' ) { showCommentReplyLinks(); }</script>\n";
    11451148}
    11461149
    11471150?>
     1151 No newline at end of file
  • wp-includes/js/comment-reply.js

     
    3232        document.location.href = "#respond";
    3333        document.getElementById("comment").focus();                             
    3434        document.getElementById("comment-parent").value = "0";
     35}
     36
     37function showCommentReplyLinks() {
     38        var divs = document.getElementsByTagName("div");
     39        var divsLength = divs.length;
     40        for (i = 0; i < divsLength; i++) {
     41                if ( "reply" == divs[i].className && "none" == divs[i].style.display ) {
     42                        divs[i].style.display = "block";
     43                }
     44        }
    3545}
     46 No newline at end of file