1( function() { 2 var is_webkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1, 3 is_opera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1, 4 is_ie = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1; 5 6 if ( ( is_webkit || is_opera || is_ie ) && 'undefined' !== typeof( document.getElementById ) ) { 7 var eventMethod = ( window.addEventListener ) ? 'addEventListener' : 'attachEvent'; 8 window[ eventMethod ]( 'hashchange', function() { 9 var element = document.getElementById( location.hash.substring( 1 ) ); 10 11 if ( element ) { 12 if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) { 13 element.tabIndex = -1; 14 } 15 16 element.focus(); 17 } 18 }, false ); 19 } 20})(); 21; 22/** 23 * File navigation.js. 24 * 25 * Handles toggling the navigation menu for small screens and enables TAB key 26 * navigation support for dropdown menus. 27 */ 28( function( $ ) { 29 30 var body, menuToggle, siteMenu, siteNavigation; 31 32 function initMainNavigation( container ) { 33 34 // Add dropdown toggle that displays child menu items. 35 var dropdownToggle = $( '<button />', { 36 'class': 'dropdown-toggle', 37 'aria-expanded': false 38 } ).append( $( '<span />', { 39 'class': 'screen-reader-text', 40 text: screenReaderText.expand 41 } ) ); 42 43 container.find( '.menu-item-has-children > a' ).after( dropdownToggle ); 44 45 // Toggle buttons and submenu items with active children menu items. 46 container.find( '.current-menu-ancestor > button' ).addClass( 'toggled-on' ); 47 container.find( '.current-menu-ancestor > .sub-menu' ).addClass( 'toggled-on' ); 48 49 // Add menu items with submenus to aria-haspopup="true". 50 container.find( '.menu-item-has-children' ).attr( 'aria-haspopup', 'true' ); 51 52 container.find( '.dropdown-toggle' ).click( function( e ) { 53 var _this = $( this ), 54 screenReaderSpan = _this.find( '.screen-reader-text' ); 55 56 e.preventDefault(); 57 _this.toggleClass( 'toggled-on' ); 58 _this.next( '.children, .sub-menu' ).toggleClass( 'toggled-on' ); 59 60 // jscs:disable 61 _this.attr( 'aria-expanded', _this.attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' ); 62 // jscs:enable 63 screenReaderSpan.text( screenReaderSpan.text() === screenReaderText.expand ? screenReaderText.collapse : screenReaderText.expand ); 64 } ); 65 } 66 initMainNavigation( $( '#site-navigation' ) ); 67 68 siteMenu = $( '#menu-primary' ); 69 siteNavigation = $( '#site-navigation' ); 70 menuToggle = siteNavigation.find( '.menu-toggle' ); 71 72 // Enable menuToggle. 73 ( function() { 74 75 // Return early if menuToggle is missing. 76 if ( ! menuToggle.length ) { 77 return; 78 } 79 80 // Add an initial values for the attribute. 81 menuToggle.add( siteNavigation ).attr( 'aria-expanded', 'false' ); 82 83 menuToggle.on( 'click.apostrophe', function() { 84 $( this ).add( siteMenu ).add( siteNavigation ).toggleClass( 'toggled-on' ); 85 86 // jscs:disable 87 $( this ).add( siteMenu ).add( siteNavigation ).attr( 'aria-expanded', $( this ).add( siteNavigation ).attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' ); 88 // jscs:enable 89 } ); 90 } )(); 91 92 // Fix sub-menus for touch devices and better focus for hidden submenu items for accessibility. 93 ( function() { 94 if ( ! siteNavigation.length || ! siteNavigation.children().length ) { 95 return; 96 } 97 98 // Toggle `focus` class to allow submenu access on tablets. 99 function toggleFocusClassTouchScreen() { 100 if ( window.innerWidth >= 840 ) { 101 $( document.body ).on( 'touchstart.apostrophe', function( e ) { 102 if ( ! $( e.target ).closest( '.main-navigation li' ).length ) { 103 $( '.main-navigation li' ).removeClass( 'focus' ); 104 } 105 } ); 106 siteNavigation.find( '.menu-item-has-children > a' ).on( 'touchstart.apostrophe', function( e ) { 107 var el = $( this ).parent( 'li' ); 108 109 if ( ! el.hasClass( 'focus' ) ) { 110 e.preventDefault(); 111 el.toggleClass( 'focus' ); 112 el.siblings( '.focus' ).removeClass( 'focus' ); 113 } 114 } ); 115 } else { 116 siteNavigation.find( '.menu-item-has-children > a' ).unbind( 'touchstart.apostrophe' ); 117 } 118 } 119 120 if ( 'ontouchstart' in window ) { 121 $( window ).on( 'resize.apostrophe', toggleFocusClassTouchScreen ); 122 toggleFocusClassTouchScreen(); 123 } 124 125 siteNavigation.find( 'a' ).on( 'focus.apostrophe blur.apostrophe', function() { 126 $( this ).parents( '.menu-item' ).toggleClass( 'focus' ); 127 } ); 128 } )(); 129 130 // Add the default ARIA attributes for the menu toggle and the navigations. 131 function onResizeARIA() { 132 if ( window.innerWidth < 840 ) { 133 if ( menuToggle.hasClass( 'toggled-on' ) ) { 134 menuToggle.attr( 'aria-expanded', 'true' ); 135 siteMenu.attr( 'aria-expanded', 'true' ); 136 siteNavigation.attr( 'aria-expanded', 'true' ); 137 } else { 138 menuToggle.attr( 'aria-expanded', 'false' ); 139 siteMenu.attr( 'aria-expanded', 'false' ); 140 siteNavigation.attr( 'aria-expanded', 'false' ); 141 } 142 } else { 143 menuToggle.removeAttr( 'aria-expanded' ); 144 siteMenu.removeAttr( 'aria-expanded' ); 145 siteNavigation.removeAttr( 'aria-expanded' ); 146 } 147 } 148 149 $( document ).ready( function() { 150 body = $( document.body ); 151 152 $( window ) 153 .on( 'load.apostrophe', onResizeARIA ) 154 .on( 'resize.apostrophe', onResizeARIA ); 155 } ); 156 157} )( jQuery );; 158/** 159 * apostrophe.js 160 * 161 * Handles the basic JS functionality for our theme. 162 */ 163( function($) { 164 /* 165 * Count the number of images in each row in order to create the proper clearings. 166 * For the most part, this isn't necessary, but there are certain instances where 167 * the grid breaks at the wrong spot, making the whole layout look funky. 168 * To fix that, we're counting where we are in the grid layout based on the space 169 * each article uses, and adding a clearing class each time we drop to a new row. 170 */ 171 function countGrid() { 172 var $body = $( 'body' ); 173 var $container = $( '#main' ); 174 var $button = $( '.menu-toggle' ); 175 176 // Only initiate script if the mobile menu toggle isn't showing and we're on a page that uses the grid. 177 // Return otherwise. 178 if ( ( 0 !== $button.offsetWidth && 0 !== $button.offsetHeight ) && 179 ! ( $body.hasClass( 'archive' ) || $body.hasClass( 'blog' ) || $body.hasClass( 'search' ) ) ) { 180 return; 181 } 182 183 var $articles = $container.find( '.post' ); 184 // This variable is used to count how far across the grid we are. 185 var gridcount = 0; 186 var gridcount_increment; 187 188 $articles.each( function() { 189 // If the article is featured, it takes up two blocks. If not, it takes up one.
190 if ( $( this ).hasClass( 'apostrophe-featured' ) ) { 191 gridcount_increment = 2; 192 } else { 193 gridcount_increment = 1; 194 } 195 // If we're at a newline in the grid, add a class to clear the previous line, and reset the grid count. 196 if ( 3 < gridcount + gridcount_increment ) { 197 gridcount = 0; 198 $( this ).addClass( 'clear' ); 199 } 200 gridcount = gridcount + gridcount_increment; 201 } ); 202 } // countGrid 203 204 // Count grid blocks on page load 205 $( document ).on( 'ready', function() { 206 countGrid(); 207 }); 208 209 // ...and on each subsequent Infinite Scroll load, as well. 210 $( document ).on( 'post-load', function() { 211 countGrid(); 212 }); 213 214 /* 215 * Use Masonry for Pinterest-style effect 216 * Currently disabled due to some weirdness, 217 * but it might be worth re-enabling as a theme option. 218 * 219 var msnry; 220 // Wait until images are loaded to initalize Masonry. 221 imagesLoaded( container, function() { 222 msnry = new Masonry( container, { 223 columnWidth: 'article', 224 itemSelector: 'article', 225 } ); 226 } ); 227 */ 228 229} )(jQuery); 230;
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.