Skip to:
Content

bbPress.org

Ticket #3445: 3445.patch

File 3445.patch, 2.4 KB (added by johnjamesjacoby, 3 years ago)

Patched from ./src/ as root

  • includes/common/template.php

     
    7070}
    7171
    7272/**
    73  * Add our custom head action to wp_head
     73 * Add our custom footer action to wp_footer
    7474 *
    7575 * @since 2.0.0 bbPress (r2464)
    7676 */
     
    10821082        // Any page with bbPress content
    10831083        if ( ! empty( $bbp_classes ) ) {
    10841084                $bbp_classes[] = 'bbpress';
    1085                 $bbp_classes[] = 'no-js';
     1085                $bbp_classes[] = 'bbp-no-js';
    10861086        }
    10871087
    10881088        /** Clean up **************************************************************/
     
    10981098}
    10991099
    11001100/**
     1101 * Output a small piece of JavaScript to replace the "bbp-no-js" body class
     1102 * with "bbp-js" to allow interactive & dynamic elements to work as intended.
     1103 *
     1104 * @since 2.6.10 bbPress (r7229)
     1105 */
     1106function bbp_swap_no_js_body_class() {
     1107        static $done = false;
     1108
     1109        // Bail if already done
     1110        if ( true === $done ) {
     1111                return;
     1112        }
     1113
     1114        // Mark as done
     1115        $done = true;
     1116
     1117?>
     1118
     1119<script type="text/javascript" id="bbp-swap-no-js-body-class">
     1120        document.body.className = document.body.className.replace( 'bbp-no-js', 'bbp-js' );
     1121</script>
     1122
     1123<?php
     1124}
     1125
     1126/**
    11011127 * Check if text contains a bbPress shortcode.
    11021128 *
    11031129 * Loops through registered bbPress shortcodes and keeps track of which ones
  • includes/core/actions.php

     
    129129add_action( 'bbp_init', 'bbp_reply_content_autoembed', 8 );
    130130add_action( 'bbp_init', 'bbp_topic_content_autoembed', 8 );
    131131
     132// "bbp-no-js" <body> class swap to "bbp-js"
     133add_action( 'wp_body_open', 'bbp_swap_no_js_body_class' );
     134add_action( 'bbp_footer',   'bbp_swap_no_js_body_class' );
     135
    132136/**
    133137 * bbp_ready - attached to end 'bbp_init' above
    134138 *
  • templates/default/bbpress/form-user-passwords.php

     
    1313// Filters the display of the password fields
    1414if ( apply_filters( 'show_password_fields', true, bbpress()->displayed_user ) ) : ?>
    1515
    16 <script type="text/javascript">
    17         document.body.className = document.body.className.replace( 'no-js', 'js' );
    18 </script>
    19 
    2016<div id="password" class="user-pass1-wrap">
    2117        <label for="user_login"><?php esc_html_e( 'Password', 'bbpress' ); ?></label>
    2218        <button type="button" class="button wp-generate-pw hide-if-no-js"><?php esc_html_e( 'Generate Password', 'bbpress' ); ?></button>