1/** 2 * Theme functions file. 3 * 4 * Contains handlers for navigation and widget area. 5 */ 6 7(function ($) { 8 var body, masthead, menuToggle, siteNavigation, socialNavigation, siteHeaderMenu, resizeTimer; 9 10 function initMainNavigation(container) { 11 // Add dropdown toggle that displays child menu items. 12 var dropdownToggle = $('<button />', { 13 'class': 'dropdown-toggle', 14 'aria-expanded': false 15 }).append($('<span />', { 16 'class': 'screen-reader-text', 17 text: screenReaderText.expand 18 })); 19 20 container.find('.menu-item-has-children > a').after(dropdownToggle); 21 22 // Toggle buttons and submenu items with active children menu items. 23 container.find('.current-menu-ancestor > button').addClass('toggled-on'); 24 container.find('.current-menu-ancestor > .sub-menu').addClass('toggled-on'); 25 26 // Add menu items with submenus to aria-haspopup="true". 27 container.find('.menu-item-has-children').attr('aria-haspopup', 'true'); 28 29 container.find('.dropdown-toggle').click(function (e) { 30 var _this = $(this), 31 screenReaderSpan = _this.find('.screen-reader-text'); 32 33 e.preventDefault(); 34 _this.toggleClass('toggled-on'); 35 _this.next('.children, .sub-menu').toggleClass('toggled-on'); 36 37 // jscs:disable 38 _this.attr('aria-expanded', _this.attr('aria-expanded') === 'false' ? 'true' : 'false'); 39 // jscs:enable 40 screenReaderSpan.text(screenReaderSpan.text() === screenReaderText.expand ? screenReaderText.collapse : screenReaderText.expand); 41 }); 42 } 43 44 initMainNavigation($('.main-navigation')); 45 46 masthead = $('#masthead'); 47 menuToggle = masthead.find('#menu-toggle'); 48 49 // Enable menuToggle. 50 (function () { 51 52 // Return early if menuToggle is missing. 53 if (!menuToggle.length) { 54 return; 55 } 56 57 // Add an initial values for the attribute. 58 menuToggle.add(siteNavigation).add(socialNavigation).attr('aria-expanded', 'false'); 59 60 menuToggle.on('click', function () { 61 $(this).add(siteHeaderMenu).toggleClass('toggled-on'); 62 63 // jscs:disable 64 $(this).add(siteNavigation).add(socialNavigation).attr('aria-expanded', $(this).add(siteNavigation).add(socialNavigation).attr('aria-expanded') === 'false' ? 'true' : 'false'); 65 // jscs:enable 66 }); 67 })(); 68 function subMenuPosition() { 69 $('.sub-menu').each(function () { 70 $(this).removeClass('toleft'); 71 if (($(this).parent().offset().left + $(this).parent().width() - $(window).width() + 170) > 0) { 72 $(this).addClass('toleft'); 73 } 74 }); 75 } 76 77 subMenuPosition(); 78 $(window).resize(function () { 79 subMenuPosition(); 80 }); 81 // Enable menuToggle. 82 (function () { 83 $(window).load(function () { 84 $('.jetpack-testimonial-shortcode').each(function () { 85 $('.textwidget').flexslider({ 86 animation: "slide", 87 directionNav:false, 88 //smoothHeight:true, 89 keyboard:false, 90 slideshow:false, 91 selector:'.jetpack-testimonial-shortcode > .testimonial-entry', 92 start: function(){ 93 $('.textwidget .jetpack-testimonial-shortcode a').attr('tabindex',"-1") 94 } 95 }); 96 }); 97 98 }); 99 100 })(); 101})(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.