1Drupal.TBMegaMenu = Drupal.TBMegaMenu || {}; 2 3(function ($) { 4 Drupal.TBMegaMenu.createTouchMenu = function(items) { 5 items.children('a').each( function() { 6 var $item = $(this); 7 var tbitem = $(this).parent(); 8 $item.click( function(event){ 9 if ($item.hasClass('tb-megamenu-clicked')) { 10 var $uri = $item.attr('href'); 11 window.location.href = $uri; 12 } 13 else { 14 event.preventDefault(); 15 $item.addClass('tb-megamenu-clicked'); 16 if(!tbitem.hasClass('open')){ 17 tbitem.addClass('open'); 18 } 19 } 20 }).closest('li').mouseleave( function(){ 21 $item.removeClass('tb-megamenu-clicked'); 22 tbitem.removeClass('open'); 23 }); 24 }); 25 /* 26 items.children('a').children('span.caret').each( function() { 27 var $item = $(this).parent(); 28 $item.click(function(event){ 29 tbitem = $item.parent(); 30 if ($item.hasClass('tb-megamenu-clicked')) { 31 Drupal.TBMegaMenu.eventStopPropagation(event); 32 if(tbitem.hasClass('open')){ 33 tbitem.removeClass('open'); 34 $item.removeClass('tb-megamenu-clicked'); 35 } 36 } 37 else { 38 Drupal.TBMegaMenu.eventStopPropagation(event); 39 $item.addClass('tb-megamenu-clicked'); 40 if(!tbitem.hasClass('open')){ 41 tbitem.addClass('open'); 42 $item.removeClass('tb-megamenu-clicked'); 43 } 44 } 45 }); 46 }); 47 */ 48 } 49 50 Drupal.TBMegaMenu.eventStopPropagation = function(event) { 51 if (event.stopPropagation) { 52 event.stopPropagation(); 53 } 54 else if (window.event) { 55 window.event.cancelBubble = true; 56 } 57 } 58 Drupal.behaviors.tbMegaMenuTouchAction = { 59 attach: function(context) { 60 var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion); 61 if(isTouch){ 62 $('html').addClass('touch'); 63 Drupal.TBMegaMenu.createTouchMenu($('.tb-megamenu ul.nav li.mega').has('.dropdown-menu')); 64 } 65 } 66 } 67})(jQuery);
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.