1/* 2 FlexNav.js 1.3.3 3 4 Created by Jason Weaver http://jasonweaver.name 5 Released under http://unlicense.org/ 6 7// 8*/ 9 10 11(function() { 12 var $; 13 14 $ = jQuery; 15 16 $.fn.flexNav = function(options) { 17 var $nav, $top_nav_items, breakpoint, count, nav_percent, nav_width, resetMenu, resizer, settings, showMenu, toggle_selector, touch_selector, touch_selector2; 18 settings = $.extend({ 19 'animationSpeed': 250, 20 'transitionOpacity': true, 21 'buttonSelector': '.menu-button', 22 'hoverIntent': false, 23 'hoverIntentTimeout': 150, 24 'calcItemWidths': false, 25 'hover': true 26 }, options); 27 $nav = $(this); 28 $nav.addClass('with-js'); 29 if (settings.transitionOpacity === true) { 30 $nav.addClass('opacity'); 31 } 32 $nav.find("li").each(function() { 33 if ($(this).has("ul").length) { 34 return $(this).addClass("item-with-ul").find("ul").hide(); 35 } 36 }); 37 if (settings.calcItemWidths === true) { 38 $top_nav_items = $nav.find('>li'); 39 count = $top_nav_items.length; 40 nav_width = 100 / count; 41 nav_percent = nav_width + "%"; 42 } 43 if ($nav.data('breakpoint')) { 44 breakpoint = $nav.data('breakpoint'); 45 } 46 showMenu = function() { 47 if ($nav.hasClass('lg-screen') === true && settings.hover === true) { 48 if (settings.transitionOpacity === true) { 49 return $(this).find('>ul').addClass('flexnav-show').stop(true, true).animate({ 50 height: ["toggle", "swing"], 51 opacity: "toggle" 52 }, settings.animationSpeed); 53 } else { 54 return $(this).find('>ul').addClass('flexnav-show').stop(true, true).animate({ 55 height: ["toggle", "swing"] 56 }, settings.animationSpeed); 57 } 58 } 59 }; 60 resetMenu = function() { 61 if ($nav.hasClass('lg-screen') === true && $(this).find('>ul').hasClass('flexnav-show') === true && settings.hover === true) { 62 if (settings.transitionOpacity === true) { 63 return $(this).find('>ul').removeClass('flexnav-show').stop(true, true).animate({ 64 height: ["toggle", "swing"], 65 opacity: "toggle" 66 }, settings.animationSpeed); 67 } else { 68 return $(this).find('>ul').removeClass('flexnav-show').stop(true, true).animate({ 69 height: ["toggle", "swing"] 70 }, settings.animationSpeed); 71 } 72 } 73 }; 74 resizer = function() { 75 var selector; 76 if ($('body').hasClass('mobileVersion')) { 77 $nav.removeClass("lg-screen").addClass("sm-screen"); 78 if (settings.calcItemWidths === true) { 79 $top_nav_items.css('width', '100%'); 80 } 81 selector = settings['buttonSelector'] + ', ' + settings['buttonSelector'] + ' .touch-button'; 82 $(selector).removeClass('active'); 83 return $('.one-page li a').on('click', function() { 84 return $nav.removeClass('flexnav-show'); 85 }); 86 } else if (!$('body').hasClass('mobileVersion')) { 87 $nav.removeClass("sm-screen").addClass("lg-screen"); 88 if (settings.calcItemWidths === true) { 89 $top_nav_items.css('width', nav_percent); 90 } 91 $nav.removeClass('flexnav-show').find('.item-with-ul').on(); 92 $('.item-with-ul').find('ul').removeClass('flexnav-show'); 93 resetMenu(); 94 if (settings.hoverIntent === true) { 95 return $('.item-with-ul').hoverIntent({ 96 over: showMenu, 97 out: resetMenu, 98 timeout: settings.hoverIntentTimeout 99 }); 100 } else if (settings.hoverIntent === false) { 101 $('.item-with-ul').unbind('mouseenter').unbind('mouseleave'); 102 return $('.item-with-ul').on('mouseenter', showMenu).on('mouseleave', resetMenu); 103 } 104 } 105 }; 106 var custButSel = $nav.selector.match(/#menuWidget\-0\-[0-9]*/); 107 if(custButSel){ 108 settings['buttonSelector'] = custButSel[0]+' .menu-button'; 109 } 110 $(settings['buttonSelector']).data('navEl', $nav); 111 touch_selector = '.item-with-ul'; 112 $(touch_selector).append('<span class="touch-button"><i class="navicon"></i></span>'); 113 touch_selector2 = settings['buttonSelector']; 114 $(touch_selector2).append('<span class="touch-button"><i class="navicon"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></i></span>'); 115 toggle_selector = settings['buttonSelector'] + ', ' + settings['buttonSelector'] + ' .touch-button'; 116 $(toggle_selector).on('click', function(e) { 117 var $btnParent, $thisNav, bs; 118 $(toggle_selector).toggleClass('active'); 119 e.preventDefault(); 120 e.stopPropagation(); 121 bs = settings['buttonSelector']; 122 $btnParent = $(this).is(bs) ? $(this) : $(this).parent(bs); 123 $thisNav = $btnParent.data('navEl'); 124 return $thisNav.toggleClass('flexnav-show'); 125 }); 126 $('.touch-button').on('click', function(e) { 127 var $sub, $touchButton; 128 $sub = $(this).parent('.item-with-ul').find('>ul'); 129 $touchButton = $(this).parent('.item-with-ul'); 130 if ($nav.hasClass('lg-screen') === true) { 131 $(this).parent('.item-with-ul').siblings().find('ul.flexnav-show').removeClass('flexnav-show').hide(); 132 } 133 if ($sub.hasClass('flexnav-show') === true) {
134 $sub.removeClass('flexnav-show').slideUp(settings.animationSpeed); 135 return $touchButton.removeClass('activeLiClass'); 136 } else if ($sub.hasClass('flexnav-show') === false) { 137 $sub.addClass('flexnav-show').slideDown(settings.animationSpeed); 138 return $touchButton.addClass('activeLiClass'); 139 } 140 }); 141 $nav.find('.item-with-ul *').focus(function() { 142 $(this).parent('.item-with-ul').parent().find(".open").not(this).removeClass("open").hide(); 143 return $(this).parent('.item-with-ul').find('>ul').addClass("open").show(); 144 }); 145 resizer(); 146 return $(window).on('resize', resizer); 147 }; 148 149}).call(this);
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.