1/* global thesimplest_screenReaderText */ 2/** 3 * Theme functions file. 4 * 5 * Contains handlers for navigation and widget area. 6 */ 7 8( function( $ ) { 9 var body, masthead, menuToggle, siteNavigation, siteHeaderMenu, resizeTimer; 10 11 function initMainNavigation( container ) { 12 13 // Add dropdown toggle that displays child menu items. 14 var dropdownToggle = $( '<button />', { 15 'class': 'dropdown-toggle', 16 'aria-expanded': false 17 } ).append( $( '<span />', { 18 'class': 'screen-reader-text', 19 text: thesimplest_screenReaderText.expand 20 } ) ); 21 22 container.find( '.menu-item-has-children > a' ).after( dropdownToggle ); 23 24 // Toggle buttons and submenu items with active children menu items. 25 container.find( '.current-menu-ancestor > button' ).addClass( 'toggled-on' ); 26 container.find( '.current-menu-ancestor > .sub-menu' ).addClass( 'toggled-on' ); 27 28 // Add menu items with submenus to aria-haspopup="true". 29 container.find( '.menu-item-has-children' ).attr( 'aria-haspopup', 'true' ); 30 31 container.find( '.dropdown-toggle' ).click( function( e ) { 32 var _this = $( this ), 33 screenReaderSpan = _this.find( '.screen-reader-text' ); 34 35 e.preventDefault(); 36 _this.toggleClass( 'toggled-on' ); 37 _this.next( '.children, .sub-menu' ).toggleClass( 'toggled-on' ); 38 39 // jscs:disable 40 _this.attr( 'aria-expanded', _this.attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' ); 41 // jscs:enable 42 screenReaderSpan.text( screenReaderSpan.text() === thesimplest_screenReaderText.expand ? thesimplest_screenReaderText.collapse : thesimplest_screenReaderText.expand ); 43 } ); 44 } 45 initMainNavigation( $( '.main-navigation' ) ); 46 47 masthead = $( '#masthead' ); 48 menuToggle = masthead.find( '#menu-toggle' ); 49 siteHeaderMenu = masthead.find( '#site-header-menu' ); 50 siteNavigation = masthead.find( '#site-navigation' ); 51 52 // Enable menuToggle. 53 ( function() { 54 55 // Return early if menuToggle is missing. 56 if ( ! menuToggle.length ) { 57 return; 58 } 59 60 // Add an initial values for the attribute. 61 menuToggle.add( siteNavigation ).attr( 'aria-expanded', 'false' ); 62 63 menuToggle.on( 'click', function() { 64 $( this ).add( siteHeaderMenu ).toggleClass( 'toggled-on' ); 65 66 // jscs:disable 67 $( this ).add( siteNavigation ).attr( 'aria-expanded', $( this ).add( siteNavigation ).attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' ); 68 // jscs:enable 69 } ); 70 } )(); 71 72 // Fix sub-menus for touch devices and better focus for hidden submenu items for accessibility. 73 ( function() { 74 if ( ! siteNavigation.length || ! siteNavigation.children().length ) { 75 return; 76 } 77 78 // Toggle `focus` class to allow submenu access on tablets. 79 function toggleFocusClassTouchScreen() { 80 if ( window.innerWidth >= 910 ) { 81 $( document.body ).on( 'touchstart', function( e ) { 82 if ( ! $( e.target ).closest( '.main-navigation li' ).length ) { 83 $( '.main-navigation li' ).removeClass( 'focus' ); 84 } 85 } ); 86 siteNavigation.find( '.menu-item-has-children > a' ).on( 'touchstart', function( e ) { 87 var el = $( this ).parent( 'li' ); 88 89 if ( ! el.hasClass( 'focus' ) ) { 90 e.preventDefault(); 91 el.toggleClass( 'focus' ); 92 el.siblings( '.focus' ).removeClass( 'focus' ); 93 } 94 } ); 95 } else { 96 siteNavigation.find( '.menu-item-has-children > a' ).unbind( 'touchstart' ); 97 } 98 } 99 100 if ( 'ontouchstart' in window ) { 101 $( window ).on( 'resize', toggleFocusClassTouchScreen ); 102 toggleFocusClassTouchScreen(); 103 } 104 105 siteNavigation.find( 'a' ).on( 'focus blur', function() { 106 $( this ).parents( '.menu-item' ).toggleClass( 'focus' ); 107 } ); 108 } )(); 109 110 // Add the default ARIA attributes for the menu toggle and the navigations. 111 function onResizeARIA() { 112 if ( window.innerWidth < 910 ) { 113 if ( menuToggle.hasClass( 'toggled-on' ) ) { 114 menuToggle.attr( 'aria-expanded', 'true' ); 115 } else { 116 menuToggle.attr( 'aria-expanded', 'false' ); 117 } 118 119 if ( siteHeaderMenu.hasClass( 'toggled-on' ) ) { 120 siteNavigation.attr( 'aria-expanded', 'true' ); 121 } else { 122 siteNavigation.attr( 'aria-expanded', 'false' ); 123 } 124 125 menuToggle.attr( 'aria-controls', 'site-navigation' ); 126 } else { 127 menuToggle.removeAttr( 'aria-expanded' ); 128 siteNavigation.removeAttr( 'aria-expanded' ); 129 menuToggle.removeAttr( 'aria-controls' ); 130 } 131 } 132 133 134 $( document ).ready( function() { 135 body = $( document.body ); 136 137 } ); 138} )( jQuery ); 139 140/*jshint browser:true */ 141/*! 142* FitVids 1.1 143*
144* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com 145* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/ 146* Released under the WTFPL license - http://sam.zoy.org/wtfpl/ 147* 148*/ 149 150!(function( $ ){ 151 152 'use strict'; 153 154 $.fn.fitVids = function( options ) { 155 var settings = { 156 customSelector: null, 157 ignore: null 158 }; 159 160 if(!document.getElementById('fit-vids-style')) { 161 // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js 162 var head = document.head || document.getElementsByTagName('head')[0]; 163 var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}'; 164 var div = document.createElement("div"); 165 div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>'; 166 head.appendChild(div.childNodes[1]); 167 } 168 169 if ( options ) { 170 $.extend( settings, options ); 171 } 172 173 return this.each(function(){ 174 var selectors = [ 175 'iframe[src*="player.vimeo.com"]', 176 'iframe[src*="youtube.com"]', 177 'iframe[src*="youtube-nocookie.com"]', 178 'iframe[src*="kickstarter.com"][src*="video.html"]', 179 'object', 180 'embed' 181 ]; 182 183 if (settings.customSelector) { 184 selectors.push(settings.customSelector); 185 } 186 187 var ignoreList = '.fitvidsignore'; 188 189 if(settings.ignore) { 190 ignoreList = ignoreList + ', ' + settings.ignore; 191 } 192 193 var $allVideos = $(this).find(selectors.join(',')); 194 $allVideos = $allVideos.not('object object'); // SwfObj conflict patch 195 $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video. 196 197 $allVideos.each(function(){ 198 var $this = $(this); 199 if($this.parents(ignoreList).length > 0) { 200 return; // Disable FitVids on this video. 201 } 202 if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } 203 if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width')))) 204 { 205 $this.attr('height', 9); 206 $this.attr('width', 16); 207 } 208 var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(), 209 width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(), 210 aspectRatio = height / width; 211 if(!$this.attr('name')){ 212 var videoName = 'fitvid' + $.fn.fitVids._count; 213 $this.attr('name', videoName); 214 $.fn.fitVids._count++; 215 } 216 $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%'); 217 $this.removeAttr('height').removeAttr('width'); 218 }); 219 }); 220 }; 221 222 // Internal counter for unique video names. 223 $.fn.fitVids._count = 0; 224 225// Works with either jQuery or Zepto 226})( window.jQuery || window.Zepto ); 227 228/** 229 * TheSimplest Main JS 230 */ 231 232(function( $ ) { 233 234 /* ------------------------------------- 235 Search Popup 236 -------------------------------------- */ 237 $(".dark-mark").hide(); 238 239 $('.icon-button-search').on('click', function () { 240 $('.search-popup').fadeIn(200), $('.search-popup input').focus() 241 });
242 243 $('.search-popup').on('click', function (e) { 244 'search-top-bar-submit' !== e.target.className && 'search-field-top-bar' !== e.target.className && $('.search-popup').fadeOut(300) 245 }); 246 247 $('.image-navigation').not(':has(a)').addClass('hide'); 248 249 $(".entry-video").fitVids(); 250 251})(jQuery);
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.