1(function ($) { 2 'use strict'; 3 $.fn.sqrNav = function () { 4 $(this).each(function () { 5 6 var nav = $(this), 7 showNav = nav.find('.sqrnavshow'), 8 hideNav = nav.find('.sqrnavhide'), 9 allItems = nav.children('ul').children('li:has(div)'), 10 lastitem, 11 doubleClickTimeout, 12 doubleclick = false; 13 14 function handleClick(e) { 15 16 if (lastitem === this && doubleclick) return; 17 18 if (doubleClickTimeout !== undefined) window.clearTimeout(doubleClickTimeout); 19 20 doubleclick = true; 21 22 doubleClickTimeout = window.setTimeout(function () { 23 doubleclick = false; 24 }, 1000); 25 26 if ($(this).parent().hasClass('sqrnavopen')) { 27 $(this).parent('li').removeClass('sqrnavopen'); 28 } else { 29 lastitem = this; 30 allItems.removeClass('sqrnavopen'); 31 32 var li = $(this).parents('li'); 33 34 li.addClass('sqrnavopen'); 35 li.find('input').focus(); 36 37 var div = $(this).parents('li').children('div'); 38 39 div.css({ 40 'transform': 'translate3d(0,-10px,0)' 41 }); 42 div.height(); 43 div.css({ 44 'transition': 'transform 0.3s ease', 45 'transform': 'translate3d(0,0,0)' 46 }); 47 } 48 49 e.preventDefault(); 50 e.stopPropagation(); 51 } 52 53 function isMobile() { 54 return nav.children('ul').children('li').css('float') === 'none'; 55 } 56 57 function handleClose(e) { 58 if (!isMobile()) { 59 if ($(e.target).parents('.sqrnav').length === 0) { 60 allItems.removeClass('sqrnavopen'); 61 nav.removeClass('sqrnavopen'); 62 lastitem = undefined; 63 doubleclick = false; 64 if (doubleClickTimeout !== undefined) window.clearTimeout(doubleClickTimeout); 65 } 66 } 67 } 68 69 function handleShowNav(e) { 70 nav.addClass('sqrnavopen'); 71 e.preventDefault(); 72 } 73 74 function handleHideNav(e) { 75 nav.removeClass('sqrnavopen'); 76 e.preventDefault(); 77 } 78 79 allItems.addClass('sqrnavmore').children('a').on('click', handleClick); 80 showNav.on('click', handleShowNav); 81 hideNav.on('click', handleHideNav); 82 $(document).on('click touchstart', handleClose); 83 84 }); 85 86 }; 87})(jQuery); 88 89$(document).ready(function () { 90 $('.sqrnav').sqrNav(); 91});
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.