1// Generated by CoffeeScript 1.6.1 2 3/* 4 FlexNav.js 0.7 5 6 Copyright 2013, Jason Weaver http://jasonweaver.name 7 Released under the WTFPL license 8 http://sam.zoy.org/wtfpl/ 9 10// 11*/ 12 13 14(function() { 15 16 $.fn.flexNav = function(options) { 17 var $nav, breakpoint, isDragging, nav_open, resizer, settings; 18 settings = $.extend({ 19 'animationSpeed': 250 20 }, options); 21 $nav = $(this); 22 nav_open = false; 23 isDragging = false; 24 $nav.find("li").each(function() { 25 if ($(this).has("ul").length) { 26 return $(this).addClass("item-with-ul").find("ul").hide(); 27 } 28 }); 29 if ($nav.data('breakpoint')) { 30 breakpoint = $nav.data('breakpoint'); 31 } 32 resizer = function() { 33 if ($(window).width() <= breakpoint) { 34 $nav.removeClass("lg-screen").addClass("sm-screen"); 35 $('.one-page li a').on('click', function() { 36 return $nav.removeClass('show'); 37 }); 38 return $('.item-with-ul').off(); 39 } else { 40 $nav.removeClass("sm-screen").addClass("lg-screen"); 41 $nav.removeClass('show'); 42 return $('.item-with-ul').on('mouseenter', function() { 43 return $(this).find('>ul').addClass('show').stop(true, true).slideDown(settings.animationSpeed); 44 }).on('mouseleave', function() { 45 return $(this).find('>ul').removeClass('show').stop(true, true).slideUp(settings.animationSpeed); 46 }); 47 } 48 }; 49 $('.item-with-ul, .menu-button').append('<span class="touch-button"><i class="navicon">▼</i></span>'); 50 $('.menu-button, .menu-button .touch-button').on('touchstart mousedown', function(e) { 51 e.preventDefault(); 52 e.stopPropagation(); 53 console.log(isDragging); 54 return $(this).on('touchmove mousemove', function(e) { 55 var msg; 56 msg = e.pageX; 57 isDragging = true; 58 return $(window).off("touchmove mousemove"); 59 }); 60 }).on('touchend mouseup', function(e) { 61 var $parent; 62 e.preventDefault(); 63 e.stopPropagation(); 64 isDragging = false; 65 $parent = $(this).parent(); 66 if (isDragging === false) { 67 console.log('clicked'); 68 } 69 if (nav_open === false) { 70 $nav.addClass('show'); 71 return nav_open = true; 72 } else if (nav_open === true) { 73 $nav.removeClass('show'); 74 return nav_open = false; 75 } 76 }); 77 $('.touch-button').on('touchstart mousedown', function(e) { 78 e.stopPropagation(); 79 e.preventDefault(); 80 return $(this).on('touchmove mousemove', function(e) { 81 isDragging = true; 82 return $(window).off("touchmove mousemove"); 83 }); 84 }).on('touchend mouseup', function(e) { 85 var $sub; 86 e.preventDefault(); 87 e.stopPropagation(); 88 $sub = $(this).parent('.item-with-ul').find('>ul'); 89 if ($nav.hasClass('lg-screen') === true) { 90 $(this).parent('.item-with-ul').siblings().find('ul.show').removeClass('show').hide(); 91 } 92 if ($sub.hasClass('show') === true) { 93 return $sub.removeClass('show').slideUp(settings.animationSpeed); 94 } else if ($sub.hasClass('show') === false) { 95 return $sub.addClass('show').slideDown(settings.animationSpeed); 96 } 97 }); 98 $('.item-with-ul *').focus(function() { 99 $(this).parent('.item-with-ul').parent().find(".open").not(this).removeClass("open").hide(); 100 return $(this).parent('.item-with-ul').find('>ul').addClass("open").show(); 101 }); 102 resizer(); 103 return $(window).on('resize', resizer); 104 }; 105 106}).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.