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