Skip to:
Content

BuddyPress.org

Changeset 5218


Ignore:
Timestamp:
10/07/2011 04:08:03 PM (13 years ago)
Author:
boonebgorges
Message:

Fixes activity update UI for noscript. Enables no-js body tag for noscript CSS support. Fixes #3611. Props r-a-y for tweaks.

Location:
branches/1.5/bp-themes/bp-default
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.5/bp-themes/bp-default/_inc/css/default.css

    r5164 r5218  
    10901090    width: 98%;
    10911091}
     1092body.no-js form#whats-new-form textarea {
     1093    height: 50px;
     1094}
    10921095form#whats-new-form #whats-new-options select {
    10931096    max-width: 200px;
     
    11011104    overflow: auto;
    11021105    height: 0;
     1106}
     1107body.no-js #whats-new-options {
     1108    height: auto;
    11031109}
    11041110#whats-new:focus {
  • branches/1.5/bp-themes/bp-default/functions.php

    r5170 r5218  
    732732}
    733733endif;
     734
     735/**
     736 * Adds the no-js class to the body tag.
     737 *
     738 * This function ensures that the <body> element will have the 'no-js' class by default. If you're
     739 * using JavaScript for some visual functionality in your theme, and you want to provide noscript
     740 * support, apply those styles to body.no-js.
     741 *
     742 * The no-js class is removed by the JavaScript created in bp_dtheme_remove_nojs_body_class().
     743 *
     744 * @package BuddyPress
     745 * @since 1.5.1
     746 * @see bp_dtheme_remove_nojs_body_class()
     747 */
     748function bp_dtheme_add_nojs_body_class( $classes ) {
     749    $classes[] = 'no-js';
     750    return array_unique( $classes );
     751}
     752add_filter( 'bp_get_the_body_class', 'bp_dtheme_add_nojs_body_class' );
     753
     754/**
     755 * Dynamically removes the no-js class from the <body> element.
     756 *
     757 * By default, the no-js class is added to the body (see bp_dtheme_add_no_js_body_class()). The
     758 * JavaScript in this function is loaded into the <body> element immediately after the <body> tag
     759 * (note that it's hooked to bp_before_header), and uses JavaScript to switch the 'no-js' body class
     760 * to 'js'. If your theme has styles that should only apply for JavaScript-enabled users, apply them
     761 * to body.js.
     762 *
     763 * This technique is borrowed from WordPress, wp-admin/admin-header.php.
     764 *
     765 * @package BuddyPress
     766 * @since 1.5.1
     767 * @see bp_dtheme_add_nojs_body_class()
     768 */
     769function bp_dtheme_remove_nojs_body_class() {
     770?><script type="text/javascript">//<![CDATA[
     771(function(){var c=document.body.className;c=c.replace(/no-js/,'js');document.body.className=c;})();
     772//]]></script>
     773<?php
     774}
     775add_action( 'bp_before_header', 'bp_dtheme_remove_nojs_body_class' );
     776
    734777?>
Note: See TracChangeset for help on using the changeset viewer.