1/** 2 * File skip-link-focus-fix.js. 3 * 4 * Helps with accessibility for keyboard only users. 5 * 6 * Learn more: https://git.io/vWdr2 7 */ 8( function() { 9 var isWebkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1, 10 isOpera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1, 11 isIe = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1; 12 13 if ( ( isWebkit || isOpera || isIe ) && document.getElementById && window.addEventListener ) { 14 window.addEventListener( 'hashchange', function() { 15 var id = location.hash.substring( 1 ), 16 element; 17 18 if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) { 19 return; 20 } 21 22 element = document.getElementById( id ); 23 24 if ( element ) { 25 if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) { 26 element.tabIndex = -1; 27 } 28 29 element.focus(); 30 } 31 }, false ); 32 } 33})(); 34 35/** 36 * File navigation.js. 37 * 38 * Handles toggling the navigation menu for small screens and enables TAB key 39 * navigation support for dropdown menus. 40 */ 41( function() { 42 var container, button, menu, links, subMenus, i, len; 43 44 container = document.getElementById( 'site-navigation' ); 45 if ( ! container ) { 46 return; 47 } 48 49 button = container.getElementsByTagName( 'button' )[0]; 50 if ( 'undefined' === typeof button ) { 51 return; 52 } 53 54 menu = container.getElementsByTagName( 'ul' )[0]; 55 56 // Hide menu toggle button if menu is empty and return early. 57 if ( 'undefined' === typeof menu ) { 58 button.style.display = 'none'; 59 return; 60 } 61 62 menu.setAttribute( 'aria-expanded', 'false' ); 63 if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { 64 menu.className += ' nav-menu'; 65 } 66 67 button.onclick = function() { 68 if ( -1 !== container.className.indexOf( 'toggled' ) ) { 69 container.className = container.className.replace( ' toggled', '' ); 70 button.setAttribute( 'aria-expanded', 'false' ); 71 menu.setAttribute( 'aria-expanded', 'false' ); 72 } else { 73 container.className += ' toggled'; 74 button.setAttribute( 'aria-expanded', 'true' ); 75 menu.setAttribute( 'aria-expanded', 'true' ); 76 } 77 }; 78 79 // Get all the link elements within the menu. 80 links = menu.getElementsByTagName( 'a' ); 81 subMenus = menu.getElementsByTagName( 'ul' ); 82 83 // Set menu items with submenus to aria-haspopup="true". 84 for ( i = 0, len = subMenus.length; i < len; i++ ) { 85 subMenus[i].parentNode.setAttribute( 'aria-haspopup', 'true' ); 86 } 87 88 // Each time a menu link is focused or blurred, toggle focus. 89 for ( i = 0, len = links.length; i < len; i++ ) { 90 links[i].addEventListener( 'focus', toggleFocus, true ); 91 links[i].addEventListener( 'blur', toggleFocus, true ); 92 } 93 94 /** 95 * Sets or removes .focus class on an element. 96 */ 97 function toggleFocus() { 98 var self = this; 99 100 // Move up through the ancestors of the current link until we hit .nav-menu. 101 while ( -1 === self.className.indexOf( 'nav-menu' ) ) { 102 103 // On li elements toggle the class .focus. 104 if ( 'li' === self.tagName.toLowerCase() ) { 105 if ( -1 !== self.className.indexOf( 'focus' ) ) { 106 self.className = self.className.replace( ' focus', '' ); 107 } else { 108 self.className += ' focus'; 109 } 110 } 111 112 self = self.parentElement; 113 } 114 } 115 116 /** 117 * Toggles `focus` class to allow submenu access on tablets. 118 */ 119 ( function( container ) { 120 var touchStartFn, i, 121 parentLink = container.querySelectorAll( '.menu-item-has-children > a, .page_item_has_children > a' ); 122 123 if ( 'ontouchstart' in window ) { 124 touchStartFn = function( e ) { 125 var menuItem = this.parentNode, i; 126 127 if ( ! menuItem.classList.contains( 'focus' ) ) { 128 e.preventDefault(); 129 for ( i = 0; i < menuItem.parentNode.children.length; ++i ) { 130 if ( menuItem === menuItem.parentNode.children[i] ) { 131 continue; 132 } 133 menuItem.parentNode.children[i].classList.remove( 'focus' ); 134 } 135 menuItem.classList.add( 'focus' ); 136 } else { 137 menuItem.classList.remove( 'focus' ); 138 } 139 }; 140 141 for ( i = 0; i < parentLink.length; ++i ) { 142 parentLink[i].addEventListener( 'touchstart', touchStartFn, false ); 143 } 144 } 145 }( container ) ); 146} )(); 147 148// Call owl carousel for featured content. 149jQuery( document ).ready( function( $ ){ 150 151 var carousel = $( '.featured_posts' ); 152 if ( carousel.length ) { 153 carousel.imagesLoaded(function () { 154 var wrapper = carousel.parent(); 155 wrapper.append(Boston.loading_icon); 156 157 setTimeout(function () { 158 wrapper.removeClass('loading'); 159 160 carousel.owlCarousel( { 161 autoPlay: 5000, 162 items : 3, 163 itemsDesktop: 2, 164 itemsDesktopSmall: [979,2], 165 paginationNumbers: false, 166 } ); 167 168 169 }, 500); 170 171 }); 172 } 173 174 175} );
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.