WordPress.org

Make WordPress Core

Ticket #21697: 21697.diff

File 21697.diff, 2.0 KB (added by lancewillett, 3 years ago)

Refreshed patch with a bit of commenting

  • wp-content/themes/twentytwelve/style.css

     
    540540        display: inline-block; 
    541541} 
    542542 
     543/* Show navigation when JavaScript is off */  
     544.no-js .main-navigation ul.nav-menu, 
     545.no-js .main-navigation div.nav-menu > ul {  
     546        display: block;  
     547}  
     548.no-js .menu-toggle {  
     549        display: none;  
     550}  
     551 
    543552/* Banner */ 
    544553section[role="banner"] { 
    545554        margin-bottom: 48px; 
  • wp-content/themes/twentytwelve/functions.php

     
    376376        elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) ) 
    377377                $classes[] = 'custom-background-white'; 
    378378 
     379        /* 
     380         * Provides support for JavaScript-disabled visitors, 
     381         * allowing the menu to always show in small windows. 
     382         * 
     383         * Value is changed in navigation.js. 
     384         */ 
     385        $classes[] = 'no-js'; 
     386 
    379387        return $classes; 
    380388} 
    381389add_filter( 'body_class', 'twentytwelve_body_class' ); 
  • wp-content/themes/twentytwelve/js/navigation.js

     
    44 * Handles toggling the navigation menu for small screens. 
    55 */ 
    66( function() { 
     7        // Remove no-js class from body. 
     8        document.body.className = document.body.className.replace( 'no-js', 'js' ); 
     9 
    710        var button = document.getElementById( 'site-navigation' ).getElementsByTagName( 'h3' )[0], 
    811            menu   = document.getElementById( 'site-navigation' ).getElementsByTagName( 'ul' )[0]; 
    912 
    10         if ( undefined == button || undefined == menu ) 
     13        if ( undefined === button || undefined === menu ) 
    1114                return false; 
    1215 
    1316        button.onclick = function() {