1 2 3"use strict"; 4 5function desktopMenu(){ 6 if(!isResponsive(641)){ 7 // only run at 640px+ 8 jQuery('.nav-menu-main').find('li').each(function(){ 9 if(jQuery(this).find('ul.sub-menu').length){ 10 // item has a submenu 11 jQuery(this).addClass('has-submenu'); 12 } 13 }); 14 15 popupDesktopMenu(); 16 17 touchDesktopMenuFix(); 18 } 19} 20 21function responsiveMenu(){ 22 if(isResponsive(640)){ 23 // only run at 640px- 24 jQuery('.main-nav .menu-toggle').bind('touchstart MSPointerDown', function(){ 25 if(jQuery('.main-nav .nav-menu-main').hasClass('menu-opened')){ 26 jQuery('.main-nav .nav-menu-main').hide(); 27 } else { 28 jQuery('.main-nav .nav-menu-main').show(); 29 } 30 jQuery('.main-nav .nav-menu-main').toggleClass('menu-opened'); 31 32 return false; 33 }); 34 35 //iphoneMenuFix(); 36 } 37} 38 39function iphoneMenuFix(){ 40 if(isUserAgent('iphone')){ 41 jQuery('.main-nav li a').each(function(){ 42 jQuery(this).on('touchstart', function(){ 43 window.location.href = jQuery(this).attr('href'); 44 }); 45 }); 46 } 47} 48 49function touchDesktopMenuFix(){ 50 if(isTouch() && (isAndroid() || isIpad() || isMobile())){ 51 jQuery('.nav-menu-main').find('li').each(function(){ 52 jQuery(this).bind('click', function(e){ 53 e.stopPropagation(); 54 if(jQuery(this).hasClass('has-submenu')){ 55 var itemID = jQuery(this).attr('id'); 56 if(jQuery(this).hasClass('clicked-once')){ 57 // the second click on target 58 } else { 59 // if there was clicked on other item reset all except current 60 jQuery('.nav-menu-main').find('li').each(function(){ 61 if(jQuery(this).attr('id') != itemID){ 62 jQuery(this).removeClass('clicked-once'); 63 } 64 }); 65 // first click on target 66 e.preventDefault(); 67 jQuery(this).addClass('clicked-once'); 68 } 69 } else { 70 // normal flow 71 } 72 }); 73 }); 74 } 75} 76 77function popupDesktopMenu(){ 78 if(jQuery('body').hasClass('sticky-menu-enabled')){ 79 var clonedMenu = jQuery('header.site-header .nav-menu-main').clone(); 80 if(typeof clonedMenu.find('ul.nav-menu').attr('id') != "undefined"){ 81 clonedMenu.find('ul.nav-menu').attr({'id':clonedMenu.find('ul.nav-menu').attr('id')+'-clone'}); 82 } 83 clonedMenu.find('ul.nav-menu').children('li').each(function(){ 84 if(typeof jQuery(this).attr('id') != "undefined"){ 85 jQuery(this).attr({'id': jQuery(this).attr('id')+"-clone"}); 86 } 87 }); 88 jQuery('div.sticky-menu .main-nav').append(clonedMenu); 89 90 var container = jQuery('#masthead'); 91 var menu = {offset: container.offset(), height: container.outerHeight(true)}; 92 var page = jQuery('body'); 93 var scroll = (menu.offset.top + menu.height); 94 if(!isResponsive(641)){ 95 var win = jQuery(window); 96 /*win.scroll(function(){ 97 if(win.scrollTop() > scroll){ 98 page.addClass('header-scrolled'); 99 } else { 100 page.removeClass('header-scrolled'); 101 } 102 });*/ 103 104 setInterval(function(){ 105 if(win.scrollTop() > scroll){ 106 page.addClass('header-scrolled'); 107 } else { 108 page.removeClass('header-scrolled'); 109 } 110 },200); 111 } 112 } 113}
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.