Make WordPress Core

Ticket #22087: 22087.1.diff

File 22087.1.diff, 1.7 KB (added by jorbin, 14 years ago)
  • wp-content/themes/twentytwelve/js/a11yfix.js

     
     1var is_webkit = navigator.userAgent.toLowerCase().indexOf('webkit') > -1;
     2var is_opera = navigator.userAgent.toLowerCase().indexOf('opera') > -1;
     3var a11yLinks = [];   
     4
     5if((is_webkit || is_opera) && typeof(document.getElementsByClassName) !== 'undefined' && document.getElementById !== 'undefined'  ) {
     6    a11yLinks = document.getElementsByClassName('assistive-text');
     7    for(var i=0;i<a11yLinks.length;i++){
     8        a11yLinks[i].onclick=function(){
     9            var newFocusElement = document.getElementById(this.hash.substring(1));
     10            // Don't bother continueing if the element doesn't exist
     11            if (newFocusElement){
     12                newFocusElement.setAttribute('tabindex', '-1');
     13                newFocusElement.focus();
     14            }
     15        }
     16    }
     17}
  • wp-content/themes/twentytwelve/functions.php

     
    103103        wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '1.0', true );
    104104
    105105        /*
     106         * Adds JavaScript for fixing an accessability bug in webkitand opers.
     107         */
     108
     109        wp_enqueue_script( 'twentytwelve-a11y', get_template_directory_uri() . '/js/a11yfix.js', array(), '1.0', true );
     110
     111        /*
    106112         * Loads our special font CSS file.
    107113         *
    108114         * The use of Open Sans by default is localized. For languages that use