- Timestamp:
- 12/14/2018 09:23:52 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-content/themes/twentynineteen/functions.php
r44187 r44196 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 ); … … 236 234 } 237 235 add_action( 'wp_enqueue_scripts', 'twentynineteen_scripts' ); 236 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' ); 238 254 239 255 /**
Note: See TracChangeset
for help on using the changeset viewer.