Ticket #45424: 45424.13.patch
File 45424.13.patch, 3.1 KB (added by , 6 years ago) |
---|
-
src/wp-content/themes/twentynineteen/functions.php
221 221 222 222 wp_style_add_data( 'twentynineteen-style', 'rtl', 'replace' ); 223 223 224 wp_enqueue_script( 'twentynineteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );225 226 224 if ( has_nav_menu( 'menu-1' ) ) { 227 225 wp_enqueue_script( 'twentynineteen-priority-menu', get_theme_file_uri( '/js/priority-menu.js' ), array(), '1.0', true ); 228 226 wp_enqueue_script( 'twentynineteen-touch-navigation', get_theme_file_uri( '/js/touch-keyboard-navigation.js' ), array(), '1.0', true ); … … 237 235 add_action( 'wp_enqueue_scripts', 'twentynineteen_scripts' ); 238 236 239 237 /** 238 * Fix skip link focus in IE11. 239 * 240 * This does not enqueue the script because it is tiny and because it is only for IE11, 241 * thus it does not warrant having an entire dedicated blocking script being loaded. 242 * 243 * @link https://git.io/vWdr2 244 */ 245 function twentynineteen_skip_link_focus_fix() { 246 // The following is minified via `terser --compress --mangle -- js/skip-link-focus-fix.js`. 247 ?> 248 <script> 249 /(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())},!1); 250 </script> 251 <?php 252 } 253 add_action( 'wp_print_footer_scripts', 'twentynineteen_skip_link_focus_fix' ); 254 255 /** 240 256 * Enqueue supplemental block editor styles. 241 257 */ 242 258 function twentynineteen_editor_customizer_styles() { … … 263 279 264 280 require_once get_parent_theme_file_path( '/inc/color-patterns.php' ); 265 281 266 if ( 'default' === get_theme_mod( 'primary_color', 'default' ) ) { 267 $primary_color = 199; 268 } else { 269 $primary_color = absint( get_theme_mod( 'primary_color_hue', 199 ) ); 282 $primary_color = 199; 283 if ( 'default' !== get_theme_mod( 'primary_color', 'default' ) ) { 284 $primary_color = get_theme_mod( 'primary_color_hue', 199 ); 270 285 } 271 286 ?> 272 287 273 <style type="text/css" id="custom-theme-colors" <?php echo is_customize_preview() ? 'data-hue="' . $primary_color. '"' : ''; ?>>288 <style type="text/css" id="custom-theme-colors" <?php echo is_customize_preview() ? 'data-hue="' . absint( $primary_color ) . '"' : ''; ?>> 274 289 <?php echo twentynineteen_custom_colors_css(); ?> 275 290 </style> 276 291 <?php -
src/wp-content/themes/twentynineteen/js/skip-link-focus-fix.js
3 3 * 4 4 * Helps with accessibility for keyboard only users. 5 5 * 6 * This is the source file for what is minified in the twentynineteen_skip_link_focus_fix() PHP function. 7 * 6 8 * Learn more: https://git.io/vWdr2 7 9 */ 8 10 ( function() {