Making WordPress.org

Ticket #1504: 1504.1.patch

File 1504.1.patch, 41.4 KB (added by keesiemeijer, 9 years ago)

Clean up of patch

  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments.php

     
    3232                <?php endif; // check for comment navigation ?>
    3333
    3434                <ol class="comment-list">
    35                         <?php
    36                                 /* Loop through and list the comments. Tell wp_list_comments()
    37                                  * to use wporg_developer_comment() to format the comments.
     35                        <?php
     36                                $feedback_editor = false;
     37
     38                                /* Loop through and list the comments. Use wporg_developer_list_notes() to format the comments.
    3839                                 * If you want to override this in a child theme, then you can
    39                                  * define wporg_developer_comment() and that will be used instead.
    40                                  * See wporg_developer_comment() in inc/template-tags.php for more.
     40                                 * define wporg_developer_list_notes() and that will be used instead.
     41                                 * See wporg_developer_list_notes() in inc/template-tags.php for more.
    4142                                 */
    4243                                if ( is_singular( 'post' ) ) {
    4344                                        wp_list_comments();
    4445                                } else {
    4546                                        $ordered_comments = wporg_developer_get_ordered_notes();
    4647                                        if ( $ordered_comments ) {
    47                                                 wp_list_comments( array( 'callback' => 'wporg_developer_user_note' ), $ordered_comments );
     48                                                $feedback_editor = array_filter(  wp_list_pluck( $ordered_comments, 'show_editor') );
     49                                                wporg_developer_list_notes( $ordered_comments, array('avatar_size' => 32) );
    4850                                        }
    4951                                }
    5052                        ?>
     
    6264
    6365        <?php if ( \DevHub\is_parsed_post_type() && DevHub\can_user_post_note( true, get_the_ID() ) ) : ?>
    6466
    65                 <p id="add-user-note" style="display:none;"><a href=""><?php _e( 'Have a note or feedback to contribute?', 'wporg' ); ?></a></p>
     67                <?php
     68                $add_note_style = !empty( $feedback_editor ) ? '' : 'display:none;'; ?>
     69                <p id="add-user-note" style="<?php echo $add_note_style; ?>"><a href="<?php echo user_trailingslashit( get_permalink() ) . '#respond'; ?>"><?php _e( 'Have a note or feedback to contribute?', 'wporg' ); ?></a></p>
    6670
    67                 <?php comment_form( array(
    68                         'class_form'          => 'comment-form tab-container',
    69                         'comment_field'       => DevHub_User_Submitted_Content::wp_editor_comments(),
    70                         'comment_notes_after' => DevHub_Note_Preview::comment_preview() .
    71                                 '<p>' .
     71                <?php
     72                $args = array(
     73                        'comment_notes_after' => '<p>' .
    7274                                __( 'Notes should supplement code reference entries, for example examples, tips, explanations, use-cases, and best practices.', 'wporg' ) .
    7375                                '</p><p>' .
    7476                                __( 'Feedback can be to report errors or omissions with the documentation on this page. Such feedback will not be publicly posted.', 'wporg' ) .
     
    8284                                sprintf( __( '<strong>NOTE:</strong> All contributions are licensed under <a href="%s">GFDL</a> and are moderated before appearing on the site.', 'wporg' ), 'https://gnu.org/licenses/fdl.html' ) .
    8385                                '</p>',
    8486                        'label_submit'        => __( 'Add Note or Feedback', 'wporg' ),
     87                        'cancel_reply_link'   => '',
    8588                        'must_log_in'         => '<p>' . sprintf(
    8689                                __( 'You must <a href="%s">log in</a> before being able to contribute a note or feedback.', 'wporg' ),
    8790                                'https://wordpress.org/support/bb-login.php?redirect_to=' . urlencode( get_comments_link() )
    8891                        ) . '</p>',
    89                         'title_reply'         =>  '', //'Add Example'
    90                 ) ); ?>
     92                        'title_reply'         => '', //'Add Example'
     93                        'title_reply_to'      => '',
     94                );
     95               
     96                if ( class_exists( 'DevHub_Note_Preview' ) ) {
     97                        $args['comment_notes_after'] = DevHub_Note_Preview::comment_preview() . $args['comment_notes_after'];
     98                        $args['class_form']          = 'comment-form tab-container';
     99                }
    91100
     101                if( class_exists( 'DevHub_User_Submitted_Content') ) {
     102                        $args['comment_field'] = DevHub_User_Submitted_Content::wp_editor_comments();
     103                }
     104               
     105                // Insert comment form if feedback form is not already used
     106                if( empty( $feedback_editor ) ) {
     107                        comment_form( $args );
     108                }       
     109                ?>
    92110        <?php endif; ?>
    93111
    94112        <?php if ( ! \DevHub\is_parsed_post_type() && comments_open() ) : ?>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php

     
    7575        if ( ! function_exists( 'wporg_developer_get_ordered_notes' ) ) :
    7676                /**
    7777                 * Get contibuted notes ordered by vote
    78                  *
    79                  * By default only top level comments are returned.
    80                  * If child notes are included use wp_list_comments() or a custom walker for display.
    81                  * unapproved notes for the current user are included.
    8278                 *
     79                 * Only the parent notes are ordered by vote count.
     80                 * Child notes are added to to the parent note 'child_notes' property.
     81                 * Unapproved notes for the current user are included.
     82                 * Use wporg_developer_list_notes() to display the notes.
     83                 *
    8384                 * @param integer $post_id Optional. Post id to get comments for
    8485                 * @param array $args Arguments used for get_comments().
    8586                 * @return array Array with comment objects
     
    9293                                $post_id = get_the_ID();
    9394                        }
    9495
    95                         $order    = array();
    9696                        $defaults = array(
    9797                                'post__in'           => array( $post_id ),
    9898                                'type'               => 'comment',
    9999                                'status'             => 'approve',
    100100                                'include_unapproved' => array_filter( array( get_current_user_id() ) ),
    101                                 'parent'             => false,
    102101                        );
    103102
    104103                        if ( is_super_admin() ) {
    105104                                $defaults['status'] = 'all';
    106105                        }
    107106
    108                         $args = wp_parse_args( $args, $defaults );
     107                        $args     = wp_parse_args( $args, $defaults );
     108                        $comments = get_comments( $args );
    109109
    110                         $comments = get_comments( $args );
    111                
    112110                        if ( ! $comments ) {
    113111                                return;
    114112                        }
    115113
     114                        // Check if the current page is a reply to a note.
     115                        $reply_id = 0;
     116                        if ( isset( $_GET['replytocom'] ) && $_GET['replytocom'] ) {
     117                                $reply_id = absint( $_GET['replytocom'] );
     118                        }
     119
     120                        $order = $children = array();
     121                        $voting = class_exists( 'DevHub_User_Contributed_Notes_Voting' );
     122
     123                        // Remove child notes and add the vote count order for parent notes
    116124                        foreach ( $comments as $key => $comment ) {
    117                                 $order[ $key ] = (int) DevHub_User_Contributed_Notes_Voting::count_votes( $comment->comment_ID, 'difference' );
     125                                if ( 0 === (int) $comment->comment_parent ) {
     126                                        $vote_count    = $voting ? (int) DevHub_User_Contributed_Notes_Voting::count_votes( $comment->comment_ID, 'difference' ) : 0;
     127                                        $order[ $key ] = $vote_count;
     128                                } else {
     129                                        unset( $comments[ $key ] );
     130                                        $children[ $comment->comment_parent ][] = $comment;
     131                                }
    118132                        }
    119133
     134                        $show_editor = false;
     135
     136                        // Add children notes to their parents.
     137                        foreach ( $comments as $key => $comment ) {
     138                                $comments[ $key ]->child_notes = array();
     139                                $comments[ $key ]->show_editor = false;
     140
     141
     142                                if ( array_key_exists( $comment->comment_ID, $children ) ) {
     143                                        $comments[ $key ]->child_notes = array_reverse( $children[ $comment->comment_ID ] );
     144                                }
     145
     146                                if ( !$show_editor && ( $reply_id && ( $reply_id === (int) $comment->comment_ID ) ) ) {
     147                                        // Show the editor when replying to this parent comment
     148                                        $comments[ $key ]->show_editor = true;
     149                                        $show_editor = true;
     150                                }
     151                        }
     152
    120153                        // sort the posts by votes
    121154                        array_multisort( $order, SORT_DESC, $comments );
    122155
     
    124157                }
    125158        endif;
    126159
     160        if ( !function_exists( 'wporg_developer_list_notes' ) ) :
     161                /**
     162                 * List user contributed notes.
     163                 *
     164                 * @param array   $comments Array with comment objects.
     165                 * @param array   $args Comment display arguments.
     166                 * @return void
     167                 */
     168                function wporg_developer_list_notes( $comments, $args ) {
     169                        $is_user_logged_in  = is_user_logged_in();
     170                        $can_user_post_note = DevHub\can_user_post_note( true, get_the_ID() );
     171                        $user_content       = class_exists( 'DevHub_User_Submitted_Content' );
     172                        $display_editor     = $is_user_logged_in && $can_user_post_note && $user_content;
     173
     174                        foreach ( $comments as $comment ) {
     175
     176                                $comment_id = $comment->comment_ID;
     177
     178                                // Display parent comment.
     179                                wporg_developer_user_note( $comment, $args, 1 );
     180
     181                                // Show or hide feedback notes.
     182                                $class = $comment->show_editor ? '' : ' hide-if-js';
     183                                echo "<section id='feedback-{$comment_id}' class='feedback{$class}'>\n";
     184
     185                                // Display child comments.
     186                                if ( !empty( $comment->child_notes ) ) {
     187
     188                                        echo "<h4 class='feedback-title'>Feedback</h4>\n";
     189                                        echo "<ul class='children'>\n";
     190                                        foreach ( $comment->child_notes as $child_note ) {
     191                                                wporg_developer_user_note( $child_note, $args, 2, $comment->show_editor );
     192                                        }
     193                                        echo "</ul>\n";
     194                                }
     195
     196                                // Add a feedback form for logged in users.
     197                                if ( $display_editor ) {
     198                                        // Show or hide the editor depending if we're replying to a note.
     199                                        $display = $comment->show_editor ? 'show' : 'hide';
     200                                        echo DevHub_User_Submitted_Content::wp_editor_feedback( $comment, $display );
     201                                }
     202                                echo "</section><!-- .feedback -->\n";
     203
     204                                // Feedback links to log in, add feedback or show feedback.
     205                                echo "<footer class='feedback-links' >\n";
     206                                if ( $can_user_post_note ) {
     207                                        $feedback_link = trailingslashit( get_permalink() ) . "?replytocom={$comment_id}#feedback-editor-{$comment_id}";
     208                                        $display       = '';
     209                                        $aria          = '';
     210                                        if ( !$is_user_logged_in ) {
     211                                                $class         = 'login';
     212                                                $feedback_text = __( 'Log in to add feedback', 'wporg' );
     213                                                $feedback_link = 'https://wordpress.org/support/bb-login.php?redirect_to=' . urlencode( $feedback_link );
     214                                        } else {
     215                                                $class         ='add';
     216                                                $feedback_text = __( 'Add feedback to this note', 'wporg' );
     217                                                $aria          = " aria-expanded='false' aria_controls='feedback-editor-{$comment_id}' aria-label='" . esc_attr( $feedback_text ) . "'";
     218
     219                                                // Hide 'add feedback' link if editor is displayed.
     220                                                $display = $display_editor && $comment->show_editor ? ' style="display:none"' : '';
     221                                        }
     222                                        echo '<a class="feedback-' . $class . '" href="' . esc_url( $feedback_link ) . '"' . $display . $aria .' rel="nofollow">' . $feedback_text . '</a>';
     223                                }
     224
     225                                // close parent list item
     226                                echo "</footer>\n</article><!-- .comment-body -->\n</li>\n";
     227                        }
     228                }
     229        endif;
     230
    127231        if ( ! function_exists( 'wporg_developer_user_note' ) ) :
    128232                /**
    129233                 * Template for user contributed notes.
     234                 *
     235                 * @param object $comment Comment object.
     236                 * @param array $args Arguments.
     237                 * @param int $depth Nested comment depth.
     238                 * @return void
    130239                 */
    131240                function wporg_developer_user_note( $comment, $args, $depth ) {
    132                         $GLOBALS['comment'] = $comment;
    133                         $count = (int) DevHub_User_Contributed_Notes_Voting::count_votes( $comment->comment_ID, 'difference' );
    134                         $curr_user_note = DevHub_User_Contributed_Notes_Voting::is_current_user_note( $comment->comment_ID );
     241                        $GLOBALS['comment']       = $comment;
     242                        $GLOBALS['comment_depth'] = $depth;
    135243
     244                        $approved       = ( 0 < (int) $comment->comment_approved ) ? true : false;
     245                        $is_parent      = ( 0 === (int) $comment->comment_parent ) ? true : false;
     246                        $is_voting      = class_exists( 'DevHub_User_Contributed_Notes_Voting' );
     247                        $count          = $is_voting ? (int)  DevHub_User_Contributed_Notes_Voting::count_votes( $comment->comment_ID, 'difference' ) : 0;
     248                        $curr_user_note = $is_voting ? (bool) DevHub_User_Contributed_Notes_Voting::is_current_user_note( $comment->comment_ID ) : false;
     249
     250                        // Classes
    136251                        $comment_class = array();
     252
    137253                        if ( -1 > $count ) {
    138254                                $comment_class[] = 'bad-note';
    139255                        }
     256
    140257                        if ( $curr_user_note ) {
    141258                                $comment_class[] = 'user-submitted-note';
    142259                        }
     260
     261                        if ( !$approved ) {
     262                                $comment_class[] = 'user-note-moderated';
     263                        }
     264
     265                        // This would all be moot if core passed the $comment context for 'get_comment_author_link' filter
     266                        if ( $comment->user_id ) {
     267                                $commenter = get_user_by( 'id', $comment->user_id );
     268                                $url = 'https://profiles.wordpress.org/' . esc_attr( $commenter->user_nicename ) . '/';
     269                                $author = get_the_author_meta( 'display_name', $comment->user_id );
     270                        } else {
     271                                $url = $comment->comment_author_url;
     272                                $author = $comment->comment_author;
     273                        }
     274
     275                        $comment_author_link = $author;
     276                        if ( $url ) {
     277                                $comment_author_link = "<a href='$url' rel='external nofollow' class='url'>$author</a>";
     278                        }
     279
     280                        $date = sprintf( _x( '%1$s ago', '%1$s = human-readable time difference', 'wporg' ),
     281                                human_time_diff( get_comment_time( 'U' ),
     282                                        current_time( 'timestamp' ) )
     283                        );
    143284                        ?>
     285                        <li id="comment-<?php comment_ID(); ?>" data-comment-id="<?php echo $comment->comment_ID;  ?>" <?php comment_class( implode( ' ', $comment_class ) ); ?>>
     286                        <article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
    144287
    145                         <li id="comment-<?php comment_ID(); ?>" <?php comment_class( implode( ' ', $comment_class ) ); ?>>
    146                         <article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
    147                                 <a href="#comment-content-<?php echo $comment->comment_ID; ?>" class="screen-reader-text"><?php _e( 'Skip to note content', 'wporg' ); ?></a>
     288                        <?php if ( $is_parent ) : ?>
     289                                <a href="#comment-content-<?php echo $comment->comment_ID; ?>" class="screen-reader-text"><?php _e( 'Skip to note content', 'wporg' ); ?></a>
    148290                                <header class="comment-meta">
    149                                         <?php DevHub_User_Contributed_Notes_Voting::show_voting(); ?>
     291
     292                                <?php
     293                                if ( $is_voting ) {
     294                                        DevHub_User_Contributed_Notes_Voting::show_voting();
     295                                }
     296                                ?>
    150297                                        <div class="comment-author vcard">
    151298                                                <span class="comment-author-attribution">
    152                                                 <?php if ( 0 != $args['avatar_size'] ) {
    153                                                                 echo get_avatar( $comment, $args['avatar_size'] );
    154                                                 } ?>
    155 
    156299                                                <?php
    157                                                         // This would all be moot if core passed the $comment context for 'get_comment_author_link' filter
    158                                                         if ( $comment->user_id ) {
    159                                                                 $commenter = get_user_by( 'id', $comment->user_id );
    160                                                                 $url = 'https://profiles.wordpress.org/' . esc_attr( $commenter->user_nicename ) . '/';
    161                                                                 $author = get_the_author_meta( 'display_name', $comment->user_id );
    162                                                         } else {
    163                                                                 $url = $comment->comment_author_url;
    164                                                                 $author = $comment->comment_author;
    165                                                         }
     300                                                if ( 0 != $args['avatar_size'] ) {
     301                                                        echo get_avatar( $comment, $args['avatar_size'] );
     302                                                }
    166303
    167                                                         $comment_author_link = '';
    168                                                         if ( $url ) {
    169                                                                 $comment_author_link = "<a href='$url' rel='external nofollow' class='url'>";
    170                                                         }
    171                                                         $comment_author_link .= $author;
    172                                                         if ( $url ) {
    173                                                                 $comment_author_link .= '</a>';
    174                                                         }
    175 
    176                                                         printf( __( 'Contributed by %s', 'wporg' ), sprintf( '<cite class="fn">%s</cite>', $comment_author_link ) );
     304                                                printf( __( 'Contributed by %s', 'wporg' ), sprintf( '<cite class="fn">%s</cite>', $comment_author_link ) );
    177305                                                ?>
    178306
    179307                                                </span>
    180308                                                &mdash;
    181309                                                <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
    182310                                                        <time datetime="<?php comment_time( 'c' ); ?>">
    183                                                         <?php
    184                                                                 printf( _x( '%1$s ago', '%1$s = human-readable time difference', 'wporg' ),
    185                                                                         human_time_diff( get_comment_time( 'U' ),
    186                                                                         current_time( 'timestamp' ) )
    187                                                                 );
    188                                                         ?>
     311                                                        <?php echo $date;  ?>
    189312                                                        </time>
    190313                                                </a>
    191                                                 <?php edit_comment_link( __( 'Edit', 'wporg' ), '<span class="edit-link">&mdash; ', '</span>' ); ?>
     314                                                <?php edit_comment_link( __( 'Edit', 'wporg' ), '<span class="edit-link">&mdash; ', '</span> ' ); ?>
     315                                                <?php if ( !$approved ) : ?>
     316                                                        &mdash; <span class="comment-awaiting-moderation"><?php _e( 'awaiting moderation', 'wporg' ); ?></span>
     317                                                <?php endif; ?>
     318
    192319                                        </div>
    193320                                </header>
    194321                                <!-- .comment-metadata -->
     322                        <?php endif; ?>
    195323
    196324                                <div class="comment-content" id="comment-content-<?php echo $comment->comment_ID; ?>">
    197                                         <?php comment_text(); ?>
    198                                 </div>
    199                                 <!-- .comment-content -->
     325                                <?php
     326                                if ( $is_parent ) {
     327                                        comment_text();
     328                                } else {
    200329
    201                                 <?php if ( '0' == $comment->comment_approved ) : ?>
    202                                         <footer class="comment-footer">
    203                                                 <p class="comment-awaiting-moderation"><?php _e( 'Your note is awaiting moderation.', 'wporg' ); ?></p>
    204                                         </footer>
    205                                         <!-- .comment-footer -->
    206                                 <?php endif; ?>
     330                                        $text = get_comment_text()  . ' &mdash; ';
     331                                        $text .= sprintf( __( 'By %s', 'wporg' ), sprintf( '<cite class="fn">%s</cite>', $comment_author_link ) ) . ' &mdash; ';
     332                                        $text .= ' <a href="'. esc_url( get_comment_link( $comment->comment_ID ) ) . '">';
     333                                        $text .= '<time datetime="' . get_comment_time( 'c' ) . '">' . $date . '</time></a>';
    207334
    208                                 <?php
    209                                         comment_reply_link( array_merge( $args, array(
    210                                                 'add_below' => 'div-comment',
    211                                                 'depth'     => $depth,
    212                                                 'max_depth' => $args['max_depth'],
    213                                                 'before'    => '<div class="reply">',
    214                                                 'after'     => '</div>',
    215                                         ) ) );
     335                                        if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) {
     336                                                $text .= ' &mdash; <a class="comment-edit-link" href="' . get_edit_comment_link( $comment->comment_ID ) .'">';
     337                                                $text .= __( 'Edit', 'wporg' ) . '</a>';
     338                                        }
     339
     340                                        if ( !$approved ) {
     341                                                $text .= ' &mdash; <span class="comment-awaiting-moderation">' . __( 'awaiting moderation', 'wporg' ) . '</span>';
     342                                        }
     343
     344                                        echo apply_filters( 'comment_text', $text );
     345                                }
    216346                                ?>
    217                         </article><!-- .comment-body -->
    218                         <?php
     347                                </div><!-- .comment-content -->
     348
     349                        <?php if ( !$is_parent ) : ?>
     350                        </article>
     351                        </li>
     352                        <?php endif; ?>
     353                <?php           
    219354                }
    220355        endif; // ends check for wporg_developer_user_note()
    221356
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content.php

     
    4040                // Remove reply to link
    4141                add_filter( 'comment_reply_link',              '__return_empty_string' );
    4242
     43                // Remove cancel reply link
     44                add_filter( 'cancel_comment_reply_link',       '__return_empty_string' );
     45
    4346                // Disable smilie conversion
    4447                remove_filter( 'comment_text',                 'convert_smilies',    20 );
    4548
     
    5861                // Tweak code contained in shortcode
    5962                add_filter( 'syntaxhighlighter_precode',       array( __CLASS__, 'syntaxhighlighter_precode' ) );
    6063
     64                // Allowed HTML for a new child comment
     65                add_filter( 'preprocess_comment', array( __CLASS__, 'comment_new_allowed_html' ) );
     66
     67                // Allowed HTML for an edited child comment (There is no decent hook to filter child comments only)
     68                add_action( 'edit_comment', array( __CLASS__, 'comment_edit_allowed_html' ) );
     69
    6170        }
    6271
    6372        /**
     
    7988        }
    8089
    8190        /**
     91         * Updates edited child comments with allowed HTML.
     92         * Allowed html is <strong>, <em>, <code> and <a>.
     93         *
     94         * @param int $comment_ID Comment ID.
     95         */
     96        public static function comment_edit_allowed_html( $comment_ID ) {
     97
     98                // Get the edited comment.
     99                $comment = get_comment( $comment_ID, ARRAY_A );
     100                if ( empty( $comment ) ) {
     101                        return;
     102                }
     103
     104                if ( ( 0 === (int) $comment['comment_parent'] ) || empty( $comment['comment_content'] ) ) {
     105                        return;
     106                }
     107
     108                $content = $comment['comment_content'];
     109                $data    = self::comment_new_allowed_html( $comment );
     110
     111                if ( $data['comment_content'] !== $content ) {
     112                        $commentarr = array(
     113                                'comment_ID' => $data['comment_ID'],
     114                                'comment_content' => $data['comment_content']
     115                        );
     116
     117                        // Update comment content.
     118                        wp_update_comment( $commentarr );
     119                }
     120        }
     121
     122        /**
     123         * Filter new child comments content with allowed HTML.
     124         * Allowed html is <strong>, <em>, <code> and <a>.
     125         *
     126         * @param array $commentdata Array with comment data.
     127         * @return array Array with filtered comment data.
     128         */
     129        public static function comment_new_allowed_html( $commentdata ) {
     130                $comment_parent = isset( $commentdata['comment_parent'] ) ? absint( $commentdata['comment_parent'] ) : 0;
     131                $comment_content = isset( $commentdata['comment_content'] ) ? trim( $commentdata['comment_content'] ) : '';
     132
     133                if ( ( $comment_parent === 0 ) || !$comment_content ) {
     134                        return $commentdata;
     135                }
     136
     137                $allowed_html = array(
     138                        'a'      => array(
     139                                'href'   => true,
     140                                'rel'    => true,
     141                                'target' => true,
     142                        ),
     143                        'em'     => array(),
     144                        'strong' => array(),
     145                        'code'   => array(),
     146                );
     147
     148                $allowed_protocols = array( 'http', 'https' );
     149
     150                $comment_content = wp_kses( $comment_content, $allowed_html, $allowed_protocols );
     151                $commentdata['comment_content'] = preg_replace( '/\r?\n|\r/', '', $comment_content );
     152
     153                return $commentdata;
     154        }
     155
     156        /**
    82157         * Enqueues scripts and styles.
    83158         */
    84159        public static function scripts_and_styles() {
     
    87162                        wp_enqueue_style( 'syntaxhighlighter-core' );
    88163                        wp_enqueue_style( 'syntaxhighlighter-theme-default' );
    89164
    90                         wp_enqueue_script( 'wporg-developer-user-notes', get_template_directory_uri() . '/js/user-notes.js', array( 'quicktags' ), '20160824', true );
    91                         if ( get_option( 'thread_comments' ) ) {
    92                                 wp_enqueue_script( 'comment-reply' );
    93                         }
     165                        wp_enqueue_script( 'wporg-developer-user-notes', get_template_directory_uri() . '/js/user-notes.js', array( 'jquery', 'quicktags' ), '20160809', true );
     166                        wp_enqueue_script( 'wporg-developer-user-notes-feedback', get_template_directory_uri() . '/js/user-notes-feedback.js', array( 'jquery', 'quicktags' ), '20160809', true );
     167                        wp_localize_script( 'wporg-developer-user-notes-feedback', 'wporg_note_feedback', array(
     168                                'show'        => __( 'Show Feedback', 'wporg' ),
     169                                'hide'        => __( 'Hide Feedback', 'wporg' ),
     170                        ) );
    94171                }
    95172        }
    96173
     
    154231                return ob_get_clean();
    155232        }
    156233
     234        /**
     235         * Capture an {@see wp_editor()} instance as the 'User Contributed Notes' feedback form.
     236         *
     237         * Uses output buffering to capture the editor instance.
     238         *
     239         * @return string HTML output for the wp_editor-ized feedback form.
     240         */
     241        public static function wp_editor_feedback( $comment, $display = 'show', $content = '' ) {
     242
     243                if ( !( isset( $comment->comment_ID ) && absint( $comment->comment_ID ) ) ) {
     244                        return '';
     245                }
     246
     247                $comment_id = absint( $comment->comment_ID );
     248
     249                static $instance = 0;
     250                $instance++;
     251
     252                $display = ( 'hide' === $display ) ? ' style="display: none;"' : '';
     253                $title = __( 'Add feedback to this note', 'wporg' );
     254                $form_type = '';
     255                $button_text = __( 'Add Feedback', 'wporg' );
     256
     257                if ( !empty( $content ) ) {
     258                        $title = __( 'Edit feedback', 'wporg' );
     259                        $form_type = '-edit';
     260                        $button_text = __( 'Edit Feedback', 'wporg' );
     261                }
     262
     263                $allowed_tags = '';
     264                foreach ( array( '<strong>', '<em>', '<code>', '<a>' ) as $tag ) {
     265                        $allowed_tags .= '<code>' . htmlentities( $tag ) . '</code>, ';
     266                }
     267
     268                ob_start();
     269                echo "<div id='feedback-editor-{$comment_id}' class='feedback-editor'{$display}>\n";
     270                echo "<p class='feedback-editor-title'>{$title}</p>\n";
     271                echo '<form id="feedback-form-' . $instance . $form_type . '" class="feedback-form" method="post" action="' . site_url( '/wp-comments-post.php' ) . '" name="feedback-form-' . $instance ."\">\n";
     272
     273                wp_editor( '', 'feedback-' . $instance, array(
     274                        'media_buttons' => false,
     275                        'textarea_name' => 'comment',
     276                        'textarea_rows' => 3,
     277                        'quicktags'     => array(
     278                                'buttons' => 'strong,em'
     279                        ),
     280                        'teeny'         => true,
     281                        'tinymce'       => false,
     282                ) );
     283
     284                echo '<p><strong>' . __( 'Note', 'wporg' ) . '</strong>: ' . __( 'No newlines allowed', 'wporg' ) . '. ';
     285                printf( __( 'Allowed tags: %s', 'wporg' ), trim( $allowed_tags, ', ' ) ) . "</p>\n";
     286                echo "<p><input id='submit-{$instance}' class='submit' type='submit' value='Add Feedback' name='submit-{$instance}'>\n";
     287                echo "<input type='hidden' name='comment_post_ID' value='" . get_the_ID() . "' id='comment_post_ID-{$instance}' />\n";
     288                echo "<input type='hidden' name='comment_parent' id='comment_parent-{$instance}' value='{$comment_id}' />\n";
     289                echo "</p>\n</form>\n</div><!-- #feedback-editor-{$comment_id} -->\n";
     290                return ob_get_clean();
     291        }
     292
    157293} // DevHub_User_Submitted_Content
    158294
    159295DevHub_User_Submitted_Content::init();
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes-feedback.js

     
     1( function( $ ) {
     2
     3        if ( undefined === wporg_note_feedback ) {
     4                return;
     5        }
     6
     7        var options        = wporg_note_feedback;
     8        var wpAdminBar     = $('#page.admin-bar').length ? 32 : 0;
     9        var feedbackToggle = $( '<a class="feedback-toggle" href="#">' + options.show + '</a>' );
     10        var hash           = window.location.hash;
     11
     12        // Check if the fragment identifier is a comment ID (e.g. #comment-63)
     13        if ( !hash.match( /#comment\-[0-9]+$/ ) ) {
     14                hash = '';
     15        }
     16       
     17        $( '.feedback-editor' ).each( function() {
     18
     19                // Hide hidden editor with 'hide-if-js' class.
     20                if( 'none' === $(this).css('display') ) {
     21                        $( this ).show().addClass( 'hide-if-js' );
     22                }
     23
     24                // Add quicktag 'inline code' button to editor.
     25                var id = $( this ).find( 'textarea' ).attr( 'id' );
     26                if ( id.length ) {
     27                        QTags.addButton( 'inline-code', 'inline code', '<code>', '</code>', '', '', '', id );
     28                }
     29        } );
     30
     31        // Loop through feedback notes
     32        $( '.comment' ).each( function() {
     33                var feedbackLinks = $( this ).find( '.feedback-links' );
     34                var childComments = $( this ).find( 'ul.children' );
     35               
     36                if ( childComments.length && feedbackLinks.length ) {
     37                        var feedback = $( this ).find( '.feedback' );
     38                        var toggle = feedbackToggle.clone();
     39
     40                        toggle.attr( {
     41                                'aria-expanded': 'false',
     42                                'aria-controls': 'feedback-' + getCommentID( $(this) )
     43                        } );
     44
     45                        // Set text to 'Hide Feedback' if feedback is displayed
     46                        if ( !feedback.hasClass( 'hide-if-js' ) ) {
     47                                toggle.text( options.hide );
     48                        }
     49
     50                        feedbackLinks.find( '.feedback-add' ).show();
     51                        feedbackLinks.append( toggle );
     52                }
     53
     54                if ( feedbackLinks.length ) {
     55                        // Move feedback links before feedback.
     56                        clonedElements = $( '<div class="feedback-links"></div>' ).append( feedbackLinks.clone().children() );
     57
     58                        $( this ).find( '.feedback' ).first().before( clonedElements );
     59                        feedbackLinks.addClass( 'bottom hide-if-js' );
     60                }
     61        } );
     62
     63        // Returns comment ID from data attribute.
     64        function getCommentID( el ) {
     65                return $(el).is("[data-comment-id") ? el.data( 'comment-id' ) : 0;
     66        }
     67
     68        // Removes added elements
     69        function resetComment( el ) {
     70
     71                var children = el.find( 'ul.children' );
     72                if ( !children.length ) {
     73                        el.find( '.feedback-toggle' ).remove();
     74                }
     75
     76                el.find( '.feedback-links.bottom' ).addClass( 'hide-if-js' );
     77        }
     78
     79        // Show hidden child comments if the fragment identifier is a comment ID (e.g. #comment-63). 
     80        $( document ).ready( function() {
     81
     82                var childComments = $( '.comment' ).find( 'ul.children' );
     83
     84                if ( !( hash.length && childComments.length ) ) {
     85                        return;
     86                }
     87
     88                var hashComment = childComments.find( hash ).first();
     89                if ( hashComment.length ) {
     90                        // Child comment exists.
     91
     92                        var parent = hashComment.closest( '.comment.depth-1' );
     93                        if ( parent.find( '.feedback' ).hasClass( 'hide-if-js' ) ) {
     94                                // Show child comments.
     95                                parent.find( '.feedback-toggle' ).first().trigger( 'click' );
     96                        }
     97
     98                        // Scroll to the child comment.
     99                        var pos = hashComment.offset();
     100                        $( 'html,body' ).animate( {
     101                                scrollTop: pos.top - wpAdminBar
     102                        }, 1 );
     103                }
     104        } );
     105
     106        // Show/Hide feedback toggle link.
     107        $( document ).on( 'click', '.feedback-toggle', function( e ) {
     108                e.preventDefault();
     109
     110                var parent = $( this ).closest( '.comment.depth-1' );
     111                if ( !parent.length ) {
     112                        return;
     113                }
     114
     115                resetComment( parent );
     116                var feedback = parent.find( '.feedback' );
     117                var toggleLinks = parent.find( '.feedback-toggle' );
     118
     119                if ( feedback.hasClass( 'hide-if-js' ) ) {
     120                        // Feedback is hidden.
     121
     122                        // Show feedback.
     123                        toggleLinks.text( options.hide );
     124                        feedback.removeClass( 'hide-if-js' );
     125                        toggleLinks.attr( 'aria-expanded', 'true' );
     126
     127                        // Go to the clicked feedback toggle link.
     128                        var pos = $( this ).offset();
     129                        $( 'html,body' ).animate( {
     130                                scrollTop: pos.top - wpAdminBar
     131                        }, 1000 );
     132
     133                        // Add feedback links at the bottom if there are over 3 feedback notes.
     134                        var children = parent.find( 'ul.children > li' );
     135                        if ( 3 < children.length ) {
     136                                var feedbackLinks = parent.find( '.feedback-links.bottom' );
     137                                feedbackLinks.removeClass( 'hide-if-js' );
     138                        }
     139
     140                } else {
     141                        // Hide feedback.
     142                        toggleLinks.text( options.show );
     143                        feedback.addClass( 'hide-if-js' );
     144                        toggleLinks.attr( 'aria-expanded', 'false' );
     145
     146                        // Hide editor.
     147                        var editor = feedback.find( '.feedback-editor' );
     148                        editor.addClass( 'hide-if-js' );
     149
     150                        parent.find( '.feedback-add' ).attr( 'aria-expanded', 'false' );
     151                }
     152        } );
     153
     154        // Show editor when the add feedback link is clicked.
     155        $( document ).on( 'click', '.feedback-add', function( e ) {
     156                e.preventDefault();
     157
     158                var parent = $( this ).closest( '.comment.depth-1' );
     159                if ( !parent.length ) {
     160                        return;
     161                }
     162
     163                resetComment( parent );
     164
     165                var feedback = parent.find( '.feedback' );
     166                var children = parent.find( 'ul.children' );
     167                var feedbackLinks = parent.find( '.feedback-add' );
     168
     169                // Show feedback.
     170                feedback.removeClass( 'hide-if-js' );
     171                feedbackLinks.attr( 'aria-expanded', 'true' );
     172
     173                // Show the feedback editor.
     174                var editor = feedback.find( '.feedback-editor' );
     175                editor.removeClass( 'hide-if-js' );
     176
     177                // Change the toggle link text to 'Hide Feedback'.
     178                var toggleLinks = parent.find( '.feedback-toggle' );
     179                if ( toggleLinks.length ) {
     180                        toggleLinks.attr( 'aria-expanded', 'true' );
     181                        toggleLinks.text( options.hide );
     182                }
     183
     184                // If there are no child comments add a 'Hide Feedback' link.
     185                if ( !children.length ) {
     186                        var hide = feedbackToggle.clone();
     187                        hide.text( options.hide );
     188                        hide.attr( {
     189                                'aria-expanded': 'true',
     190                                'aria-controls': 'feedback-' + getCommentID( parent )
     191                        } );
     192                        parent.find( '.feedback-links' ).append( hide );
     193                }
     194
     195                // Go to the feedback editor and give it focus.
     196                var pos = editor.offset();
     197                $( 'html,body' ).animate( {
     198                        scrollTop: pos.top - wpAdminBar
     199                }, 1000, function() {
     200                        editor.find( 'textarea' ).focus();
     201                } );
     202        } );
     203
     204} )( jQuery );
     205 No newline at end of file
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes.js

     
    1313
    1414        function showCommentForm() {
    1515                $( '#respond' ).show();
    16                 $( '#add-user-note').hide();
     16                $( '#add-user-note' ).hide();
    1717
    18                 var target = $( '#commentform #add-note-or-feedback' );
     18                var wpAdminBar = $('#page.admin-bar').length ? 32 : 0;
     19                var target     = $( '#commentform #add-note-or-feedback' );
    1920                if ( target.length ) {
    2021                        var pos = target.offset();
    2122
    2223                        $( 'html,body' ).animate( {
    23                                 scrollTop: pos.top
     24                                scrollTop: pos.top - wpAdminBar
    2425                        }, 1000 );
    2526                }
    2627        }
     
    3738        }
    3839
    3940        // Add php and js buttons to QuickTags.
    40         QTags.addButton( 'php', 'php', '[php]', '[/php]' );
    41         QTags.addButton( 'js', 'js', '[js]', '[/js]' );
    42         QTags.addButton( 'inline-code', 'inline code', '<code>', '</code>' );
     41        QTags.addButton( 'php', 'php', '[php]', '[/php]', '', '', '', 'comment' );
     42        QTags.addButton( 'js', 'js', '[js]', '[/js]', '', '', '', 'comment' );
     43        QTags.addButton( 'inline-code', 'inline code', '<code>', '</code>', '', '', '', 'comment' );
    4344
    4445        // Override tab within user notes textarea to actually insert a tab character.
    4546        // Copied from code within core's wp-admin/js/common.js.
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss

     
    12161216                        opacity: 1;
    12171217                }
    12181218
     1219                .comment-awaiting-moderation {
     1220                        background-color: #fff8e5;
     1221                        padding: .2em .5em;
     1222                        border-radius: 3px;
     1223                        border: 1px solid #ffb900;
     1224                }
     1225
     1226                .depth-2 .comment-awaiting-moderation {
     1227                        display: inline-block;
     1228                        margin: 2px 0;
     1229                }
     1230
    12191231                .comment-list,
    12201232                .comment-list ol {
    12211233                        list-style: none;
     
    12251237
    12261238                .comment-list li,
    12271239                #comment-preview {
    1228                         margin-top: 2.5rem;
     1240                        margin-top: 3rem;
    12291241                        background: #fff;
    12301242                        overflow: auto;
    1231                         border: 1px solid #dfdfdf;
    1232                         border-radius: 0 2px 2px 2px;
    12331243
    12341244                        article {
    12351245                                overflow: auto;
    12361246                        }
    12371247                }
    12381248
     1249                .comment-list li.depth-1,
     1250                #comment-preview {
     1251                        border: 1px solid #dfdfdf;
     1252                        border-radius: 2px;
     1253                }
     1254
     1255                /* Feedback */
     1256                .comment-list li.depth-2 {
     1257                        border-top: 1px solid #dfdfdf;
     1258                        padding: 0;
     1259                        margin: 0;
     1260
     1261                        .comment-content {
     1262                                padding: 1rem 0;
     1263                        }
     1264                        .comment-content p {
     1265                                margin-bottom: 0;
     1266                                font-size: .9em;
     1267                        }
     1268                }
     1269
     1270                .comment ul.children {
     1271                        margin: 0 0 1.5em 0;
     1272                        border-bottom: 1px solid #dfdfdf;
     1273                }
     1274
     1275                .feedback {
     1276                        width: 90%;
     1277                        float: right;
     1278                        margin-right: 1.5rem;
     1279                }
     1280
     1281                .feedback-links {
     1282                        margin: 0 1.5rem  1em 1.5rem;
     1283                        font-size: 0.9em;
     1284                        clear:both;
     1285                }
     1286
     1287                .feedback-editor-title,
     1288                .feedback-title {                       
     1289                        font-size: 1.8rem;
     1290                font-weight: 300;
     1291                line-height: 2.2rem;
     1292                margin-bottom: 1em;
     1293                }
     1294
     1295                .feedback-toggle {
     1296                        margin: 0 0 0 1.5rem;
     1297                        display: inline-block;
     1298                }
     1299
     1300                #wp-feedback-wrap {
     1301                        padding-bottom: 1em;
     1302                }
     1303
    12391304                #comment-preview,
    12401305                .js & .comment-form-comment {
    12411306                        margin-top: 0;
     
    13041369                        padding: 2rem 1.5rem .5rem;
    13051370                }
    13061371
    1307                 .comment-footer {
    1308                         margin: 0 1em;
    1309                         padding: 0 0 1em 0;
    1310                         position: relative;
    1311                         overflow: auto;
    1312 
    1313                         a {
    1314                                 float: right;
    1315                         }
    1316 
    1317                         p {
    1318                                 margin-bottom: 0;
    1319                         }
    1320                 }
    1321 
    13221372                .comment-content ol {
    13231373                        list-style: decimal inside;
    13241374                        margin: 0 0 1.5em 0;
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css

     
    15821582  word-wrap: break-word;
    15831583}
    15841584
     1585.devhub-wrap.single-wp-parser-function, .devhub-wrap.single-wp-parser-method, .devhub-wrap.single-wp-parser-hook, .devhub-wrap.single-wp-parser-class {
     1586  /* Feedback */
     1587}
     1588
    15851589.devhub-wrap.single-wp-parser-function .bad-note .comment-content, .devhub-wrap.single-wp-parser-method .bad-note .comment-content, .devhub-wrap.single-wp-parser-hook .bad-note .comment-content, .devhub-wrap.single-wp-parser-class .bad-note .comment-content {
    15861590  opacity: .6;
    15871591}
     
    15901594  opacity: 1;
    15911595}
    15921596
     1597.devhub-wrap.single-wp-parser-function .comment-awaiting-moderation, .devhub-wrap.single-wp-parser-method .comment-awaiting-moderation, .devhub-wrap.single-wp-parser-hook .comment-awaiting-moderation, .devhub-wrap.single-wp-parser-class .comment-awaiting-moderation {
     1598  background-color: #fff8e5;
     1599  padding: .2em .5em;
     1600  border-radius: 3px;
     1601  border: 1px solid #ffb900;
     1602}
     1603
     1604.devhub-wrap.single-wp-parser-function .depth-2 .comment-awaiting-moderation, .devhub-wrap.single-wp-parser-method .depth-2 .comment-awaiting-moderation, .devhub-wrap.single-wp-parser-hook .depth-2 .comment-awaiting-moderation, .devhub-wrap.single-wp-parser-class .depth-2 .comment-awaiting-moderation {
     1605  display: inline-block;
     1606  margin: 2px 0;
     1607}
     1608
    15931609.devhub-wrap.single-wp-parser-function .comment-list,
    15941610.devhub-wrap.single-wp-parser-function .comment-list ol, .devhub-wrap.single-wp-parser-method .comment-list,
    15951611.devhub-wrap.single-wp-parser-method .comment-list ol, .devhub-wrap.single-wp-parser-hook .comment-list,
     
    16051621.devhub-wrap.single-wp-parser-method #comment-preview, .devhub-wrap.single-wp-parser-hook .comment-list li,
    16061622.devhub-wrap.single-wp-parser-hook #comment-preview, .devhub-wrap.single-wp-parser-class .comment-list li,
    16071623.devhub-wrap.single-wp-parser-class #comment-preview {
    1608   margin-top: 2.5rem;
     1624  margin-top: 3rem;
    16091625  background: #fff;
    16101626  overflow: auto;
    1611   border: 1px solid #dfdfdf;
    1612   border-radius: 0 2px 2px 2px;
    16131627}
    16141628
    16151629.devhub-wrap.single-wp-parser-function .comment-list li article,
     
    16201634  overflow: auto;
    16211635}
    16221636
     1637.devhub-wrap.single-wp-parser-function .comment-list li.depth-1,
     1638.devhub-wrap.single-wp-parser-function #comment-preview, .devhub-wrap.single-wp-parser-method .comment-list li.depth-1,
     1639.devhub-wrap.single-wp-parser-method #comment-preview, .devhub-wrap.single-wp-parser-hook .comment-list li.depth-1,
     1640.devhub-wrap.single-wp-parser-hook #comment-preview, .devhub-wrap.single-wp-parser-class .comment-list li.depth-1,
     1641.devhub-wrap.single-wp-parser-class #comment-preview {
     1642  border: 1px solid #dfdfdf;
     1643  border-radius: 2px;
     1644}
     1645
     1646.devhub-wrap.single-wp-parser-function .comment-list li.depth-2, .devhub-wrap.single-wp-parser-method .comment-list li.depth-2, .devhub-wrap.single-wp-parser-hook .comment-list li.depth-2, .devhub-wrap.single-wp-parser-class .comment-list li.depth-2 {
     1647  border-top: 1px solid #dfdfdf;
     1648  padding: 0;
     1649  margin: 0;
     1650}
     1651
     1652.devhub-wrap.single-wp-parser-function .comment-list li.depth-2 .comment-content, .devhub-wrap.single-wp-parser-method .comment-list li.depth-2 .comment-content, .devhub-wrap.single-wp-parser-hook .comment-list li.depth-2 .comment-content, .devhub-wrap.single-wp-parser-class .comment-list li.depth-2 .comment-content {
     1653  padding: 1rem 0;
     1654}
     1655
     1656.devhub-wrap.single-wp-parser-function .comment-list li.depth-2 .comment-content p, .devhub-wrap.single-wp-parser-method .comment-list li.depth-2 .comment-content p, .devhub-wrap.single-wp-parser-hook .comment-list li.depth-2 .comment-content p, .devhub-wrap.single-wp-parser-class .comment-list li.depth-2 .comment-content p {
     1657  margin-bottom: 0;
     1658  font-size: .9em;
     1659}
     1660
     1661.devhub-wrap.single-wp-parser-function .comment ul.children, .devhub-wrap.single-wp-parser-method .comment ul.children, .devhub-wrap.single-wp-parser-hook .comment ul.children, .devhub-wrap.single-wp-parser-class .comment ul.children {
     1662  margin: 0 0 1.5em 0;
     1663  border-bottom: 1px solid #dfdfdf;
     1664}
     1665
     1666.devhub-wrap.single-wp-parser-function .feedback, .devhub-wrap.single-wp-parser-method .feedback, .devhub-wrap.single-wp-parser-hook .feedback, .devhub-wrap.single-wp-parser-class .feedback {
     1667  width: 90%;
     1668  float: right;
     1669  margin-right: 1.5rem;
     1670}
     1671
     1672.devhub-wrap.single-wp-parser-function .feedback-links, .devhub-wrap.single-wp-parser-method .feedback-links, .devhub-wrap.single-wp-parser-hook .feedback-links, .devhub-wrap.single-wp-parser-class .feedback-links {
     1673  margin: 0 1.5rem  1em 1.5rem;
     1674  font-size: 0.9em;
     1675  clear: both;
     1676}
     1677
     1678.devhub-wrap.single-wp-parser-function .feedback-editor-title,
     1679.devhub-wrap.single-wp-parser-function .feedback-title, .devhub-wrap.single-wp-parser-method .feedback-editor-title,
     1680.devhub-wrap.single-wp-parser-method .feedback-title, .devhub-wrap.single-wp-parser-hook .feedback-editor-title,
     1681.devhub-wrap.single-wp-parser-hook .feedback-title, .devhub-wrap.single-wp-parser-class .feedback-editor-title,
     1682.devhub-wrap.single-wp-parser-class .feedback-title {
     1683  font-size: 1.8rem;
     1684  font-weight: 300;
     1685  line-height: 2.2rem;
     1686  margin-bottom: 1em;
     1687}
     1688
     1689.devhub-wrap.single-wp-parser-function .feedback-toggle, .devhub-wrap.single-wp-parser-method .feedback-toggle, .devhub-wrap.single-wp-parser-hook .feedback-toggle, .devhub-wrap.single-wp-parser-class .feedback-toggle {
     1690  margin: 0 0 0 1.5rem;
     1691  display: inline-block;
     1692}
     1693
     1694.devhub-wrap.single-wp-parser-function #wp-feedback-wrap, .devhub-wrap.single-wp-parser-method #wp-feedback-wrap, .devhub-wrap.single-wp-parser-hook #wp-feedback-wrap, .devhub-wrap.single-wp-parser-class #wp-feedback-wrap {
     1695  padding-bottom: 1em;
     1696}
     1697
    16231698.devhub-wrap.single-wp-parser-function #comment-preview,
    16241699.js .devhub-wrap.single-wp-parser-function .comment-form-comment, .devhub-wrap.single-wp-parser-method #comment-preview,
    16251700.js .devhub-wrap.single-wp-parser-method .comment-form-comment, .devhub-wrap.single-wp-parser-hook #comment-preview,
     
    16841759  padding: 2rem 1.5rem .5rem;
    16851760}
    16861761
    1687 .devhub-wrap.single-wp-parser-function .comment-footer, .devhub-wrap.single-wp-parser-method .comment-footer, .devhub-wrap.single-wp-parser-hook .comment-footer, .devhub-wrap.single-wp-parser-class .comment-footer {
    1688   margin: 0 1em;
    1689   padding: 0 0 1em 0;
    1690   position: relative;
    1691   overflow: auto;
    1692 }
    1693 
    1694 .devhub-wrap.single-wp-parser-function .comment-footer a, .devhub-wrap.single-wp-parser-method .comment-footer a, .devhub-wrap.single-wp-parser-hook .comment-footer a, .devhub-wrap.single-wp-parser-class .comment-footer a {
    1695   float: right;
    1696 }
    1697 
    1698 .devhub-wrap.single-wp-parser-function .comment-footer p, .devhub-wrap.single-wp-parser-method .comment-footer p, .devhub-wrap.single-wp-parser-hook .comment-footer p, .devhub-wrap.single-wp-parser-class .comment-footer p {
    1699   margin-bottom: 0;
    1700 }
    1701 
    17021762.devhub-wrap.single-wp-parser-function .comment-content ol, .devhub-wrap.single-wp-parser-method .comment-content ol, .devhub-wrap.single-wp-parser-hook .comment-content ol, .devhub-wrap.single-wp-parser-class .comment-content ol {
    17031763  list-style: decimal inside;
    17041764  margin: 0 0 1.5em 0;