1jQuery(document).ready(function($) { 2 "use strict"; 3 4 if( 'undefined' == typeof hootData ) 5 window.hootData = {}; 6 7 /*** Superfish Navigation ***/ 8 9 if( 'undefined' == typeof hootData.superfish || 'enable' == hootData.superfish ) { 10 if (typeof $.fn.superfish != 'undefined') { 11 $('.sf-menu').superfish({ 12 delay: 500, // delay on mouseout 13 animation: {height: 'show'}, // animation for submenu open. Do not use 'toggle' #bug 14 animationOut: {opacity:'hide'}, // animation for submenu hide 15 speed: 200, // faster animation speed 16 speedOut: 'fast', // faster animation speed 17 disableHI: false, // set to true to disable hoverIntent detection // default = false 18 }); 19 } 20 } 21 22 /*** Responsive Navigation ***/ 23 24 if( 'undefined' == typeof hootData.menuToggle || 'enable' == hootData.menuToggle ) { 25 var $html = $('html'); 26 if ( $('#wpadminbar').length ) $html.addClass('has-adminbar'); 27 $( '.menu-toggle' ).click( function(event) { 28 event.preventDefault(); 29 var $menuToggle = $(this), 30 $navMenu = $menuToggle.parent(), 31 $menuItems = $menuToggle.siblings('.menu-items'), 32 isFixedMenu = $navMenu.is('.mobilemenu-fixed'); 33 $menuToggle.toggleClass( 'active' ); 34 if ( isFixedMenu ) { 35 $html.toggleClass( 'fixedmenu-open' ); 36 $navMenu.toggleClass( 'mobilemenu-open' ); // Redundant as css animation moved to js: used for z-index in themes with dual menus BMUMBDNx 37 if( $menuToggle.is('.active') ) { 38 $menuItems.show().css( 'left', '-' + $menuItems.outerWidth() + 'px' ).animate( {left:0}, 300 ); 39 $menuToggle.animate( { left: $menuItems.width() + 'px' }, 300 ); 40 } else { 41 $menuItems.animate( { left: '-' + $menuItems.outerWidth() + 'px' }, 300, function(){ $menuItems.hide(); } ); 42 $menuToggle.animate( { left: '0' }, 300 ); 43 } 44 } else { 45 $menuItems.css( 'left', 'auto' ).slideToggle(); // add left:auto to override inline left from fixed menu in customizer screen: added for brevity only 46 } 47 }); 48 $('body').click(function (e) { 49 if ( $html.is('.fixedmenu-open') && !$(e.target).is( '.nav-menu *, .nav-menu' ) ) 50 $( '.menu-toggle.active' ).click(); 51 }); 52 } 53 54 /*** Mobile menu - Modal Focus ***/ 55 // @todo: fix for themes with dual menus BMUMBDNx 56 // @todo: bugfix: when $lastItem does not have href, focus shifts from <a> with href to 57 // next element in document i.e. outside menu (doesnt even close it) 58 function keepFocusInMenu(){ 59 var _doc = document, 60 $menu = $('.nav-menu'), 61 $menuels = $menu.find( 'input, a, button' ), 62 $toggle = $menu.children('.menu-toggle'), 63 $lastItem = $menu.find('.menu-items > li > a'); 64 _doc.addEventListener( 'keydown', function( event ) { 65 if ( window.matchMedia( '(max-width: 969px)' ).matches ) { 66 var activeEl = _doc.activeElement, 67 toggle = $toggle[0], 68 menuOpen = $toggle.is('.active'), 69 lastEl = $menuels[ $menuels.length - 1 ], 70 lastItem = $lastItem[0], 71 tabKey = event.keyCode === 9,
72 shiftKey = event.shiftKey; 73 if ( tabKey && !shiftKey && lastEl === activeEl ) { 74 event.preventDefault(); 75 toggle.focus(); 76 } 77 if ( tabKey && shiftKey && toggle === activeEl && menuOpen ) { 78 event.preventDefault(); 79 $lastItem.focus(); 80 } 81 } 82 }); 83 } 84 keepFocusInMenu(); 85 86 /*** JS Search ***/ 87 88 $('.js-search i.fa-search, .js-search .js-search-placeholder').each(function(){ 89 var $self = $(this), 90 searchform = $self.parent('.searchform'); 91 $self.on('click', function(){ 92 searchform.toggleClass('expand'); 93 if ( searchform.is('.expand' ) ) { 94 $self.siblings('input.searchtext').focus(); 95 searchform.closest('.js-search').addClass('hasexpand'); 96 } else { 97 searchform.closest('.js-search').removeClass('hasexpand'); 98 } 99 }); 100 }); 101 $('.js-search .searchtext').each(function(){ 102 var $self = $(this), 103 searchform = $self.parent('.searchform'); 104 $self.on({ 105 focus: function() { searchform.addClass('expand').closest('.js-search').addClass('hasexpand'); }, 106 blur: function() { searchform.removeClass('expand').closest('.js-search').removeClass('hasexpand'); } 107 }); 108 }); 109 110 /*** Responsive Videos : Target your .container, .wrapper, .post, etc. ***/ 111 112 if( 'undefined' == typeof hootData.fitVids || 'enable' == hootData.fitVids ) { 113 if (jQuery.fn.fitVids) 114 $("#content").fitVids(); 115 } 116 117 /*** Theia Sticky Sidebar ***/ 118 119 if( 'undefined' == typeof hootData.stickySidebar || 'enable' == hootData.stickySidebar ) { 120 if (jQuery.fn.theiaStickySidebar && $('.hoot-sticky-sidebar .main-content-grid > #content').length && $('.hoot-sticky-sidebar .main-content-grid > .sidebar').length) { 121 var stickySidebarTop = 10; 122 if ( $('.hoot-sticky-header #header').length ) 123 stickySidebarTop = 100; 124 if( 'undefined' != typeof hootData && 'undefined' != typeof hootData.stickySidebarTop ) 125 stickySidebarTop = hootData.stickySidebarTop; 126 $( '#content, #sidebar-primary, #sidebar-secondary' ).theiaStickySidebar({ 127 additionalMarginTop: stickySidebarTop, 128 }); 129 } 130 } 131 132});
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.