1/** 2 * File navigation.js. 3 * 4 * Handles toggling the navigation menu for small screens and enables TAB key 5 * navigation support for dropdown menus. 6 */ 7( function() { 8 var container, button, menu, links, i, len; 9 10 container = document.getElementById( 'site-navigation' ); 11 if ( ! container ) { 12 return; 13 } 14 15 button = document.getElementsByClassName( 'menu-toggle' )[0]; 16 if ( 'undefined' === typeof button ) { 17 return; 18 } 19 20 menu = container.getElementsByTagName( 'ul' )[0]; 21 22 // Hide menu toggle button if menu is empty and return early. 23 if ( 'undefined' === typeof menu ) { 24 button.style.display = 'none'; 25 return; 26 } 27 28 if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { 29 menu.className += ' nav-menu'; 30 } 31 32 button.onclick = function() { 33 34 if(container.classList.contains('hidden-mobile') == true){ 35 container.className = container.className.replace( 'hidden-mobile', '' ); 36 37 button.setAttribute( 'aria-expanded', 'false' ); 38 }else{ 39 container.className += ' hidden-mobile'; 40 button.setAttribute( 'aria-expanded', 'true' ); 41 42 } 43 }; 44 45 // Close small menu when user clicks outside 46 document.addEventListener( 'click', function( event ) { 47 var isClickInside = container.contains( event.target ); 48 49 if ( ! isClickInside ) { 50 container.className = container.className.replace( ' toggled', '' ); 51 button.setAttribute( 'aria-expanded', 'false' ); 52 } 53 } ); 54 55 // Get all the link elements within the menu. 56 links = menu.getElementsByTagName( 'a' ); 57 58 // Each time a menu link is focused or blurred, toggle focus. 59 for ( i = 0, len = links.length; i < len; i++ ) { 60 links[i].addEventListener( 'focus', toggleFocus, true ); 61 links[i].addEventListener( 'blur', toggleFocus, true ); 62 } 63 64 /** 65 * Sets or removes .focus class on an element. 66 */ 67 function toggleFocus() { 68 var self = this; 69 70 // Move up through the ancestors of the current link until we hit .nav-menu. 71 while ( -1 === self.className.indexOf( 'nav-menu' ) ) { 72 // On li elements toggle the class .focus. 73 if ( 'li' === self.tagName.toLowerCase() ) { 74 if ( -1 !== self.className.indexOf( 'focus' ) ) { 75 self.className = self.className.replace( ' focus', '' ); 76 } else { 77 self.className += ' focus'; 78 } 79 } 80 81 self = self.parentElement; 82 } 83 } 84 85 /** 86 * Toggles `focus` class to allow submenu access on tablets. 87 */ 88 ( function() { 89 var touchStartFn, 90 parentLink = container.querySelectorAll( '.menu-item-has-children > a, .page_item_has_children > a' ); 91 92 if ( 'ontouchstart' in window ) { 93 touchStartFn = function( e ) { 94 var menuItem = this.parentNode; 95 96 if ( ! menuItem.classList.contains( 'focus' ) ) { 97 e.preventDefault(); 98 for ( i = 0; i < menuItem.parentNode.children.length; ++i ) { 99 if ( menuItem === menuItem.parentNode.children[i] ) { 100 continue; 101 } 102 menuItem.parentNode.children[i].classList.remove( 'focus' ); 103 } 104 menuItem.classList.add( 'focus' ); 105 } else { 106 menuItem.classList.remove( 'focus' ); 107 } 108 }; 109 110 for ( i = 0; i < parentLink.length; ++i ) { 111 parentLink[i].addEventListener( 'touchstart', touchStartFn, false ); 112 } 113 } 114 }( container ) ); 115}() ); 116 117/** 118 * File skip-link-focus-fix.js. 119 * 120 * Helps with accessibility for keyboard only users. 121 * 122 * Learn more: https://git.io/vWdr2 123 */ 124( function() { 125 var isIe = /(trident|msie)/i.test( navigator.userAgent ); 126 127 if ( isIe && document.getElementById && window.addEventListener ) { 128 window.addEventListener( 'hashchange', function() { 129 var id = location.hash.substring( 1 ), 130 element; 131 132 if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) { 133 return; 134 } 135 136 element = document.getElementById( id ); 137 138 if ( element ) { 139 if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) { 140 element.tabIndex = -1; 141 } 142 143 element.focus(); 144 } 145 }, false ); 146 } 147}() ); 148 149jQuery(document).ready(function(){ 150 151 // Toggle Scroll to top icon 152 pfx_toggle_scroll_top(); 153 154 // Scroll handler 155 jQuery(window).on("scroll.scroll_top", function(){ 156 pfx_toggle_scroll_top(); 157 }); 158 159}); 160 161// Scroll to TOP 162jQuery(document).on("click", "a.pfx-scroll-top", function(){ 163 jQuery("html, body").animate({scrollTop : 0}, 700); 164}); 165 166// Toggle Scroll to top icon 167function pfx_toggle_scroll_top(){ 168 169 var jEle = jQuery("a.pfx-scroll-top"); 170 171 if( jQuery(window).scrollTop() > 200){ 172 jEle.fadeIn(); 173 return; 174 } 175 176 jEle.fadeOut(); 177}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.