1Drupal.WeMegaMenuFrontEnd = Drupal.WeMegaMenuFrontEnd || {}; 2Drupal.WeMegaMenuFrontEnd.mobileThreadHold = 1024; 3Drupal.WeMegaMenuFrontEnd.megamenuActivated = false; 4 5(function ($, Drupal, drupalSettings) { 6 "use strict"; 7 8 Drupal.behaviors.kMegaMenuFrontEndAction = { 9 attach: function (context) { 10 $(window).on('load', function() { 11 Drupal.WeMegaMenuFrontEnd.init(); 12 // Drupal.WeMegaMenuFrontEnd.mobileMenu(); 13 }) 14 } 15 }; 16 17 Drupal.WeMegaMenuFrontEnd.init = function() { 18 if(Drupal.WeMegaMenuFrontEnd.megamenuActivated) { 19 return; 20 } 21 Drupal.WeMegaMenuFrontEnd.megamenuActivated = true; 22 var megamenu = $('nav.navbar-we-mega-menu'); 23 if(megamenu.hasClass('click-action')) { 24 megamenu.find('ul li.dropdown-menu > a').click(function() { 25 var li = $(this).closest("li"); 26 27 if(li.hasClass("clicked")) { 28 li.closest('ul').find('li').removeClass('clicked'); 29 li.closest('.we-mega-menu-row').find('li').removeClass('clicked'); 30 li.removeClass("clicked"); 31 megamenu.removeClass("has-clicked"); 32 } else { 33 li.closest('ul').find('li').removeClass('clicked'); 34 li.closest('.we-mega-menu-row').find('li').removeClass('clicked'); 35 li.closest("ul").children("li.dropdown-menu").removeClass("clicked"); 36 li.addClass("clicked"); 37 megamenu.addClass("has-clicked"); 38 } 39 if($(window).outerWidth() > Drupal.WeMegaMenuFrontEnd.mobileThreadHold) { 40 return false; 41 } 42 }); 43 megamenu.find('ul li.dropdown-menu > a').dblclick(function() { 44 if($(window).outerWidth() > Drupal.WeMegaMenuFrontEnd.mobileThreadHold) { 45 window.location.href = $(this).attr("href"); 46 } 47 }); 48 megamenu.click(function(event) { 49 event.stopPropagation(); 50 }) 51 $("body").click(function() { 52 megamenu.find("ul li.dropdown-menu.clicked").removeClass('clicked'); 53 megamenu.removeClass("has-clicked"); 54 }); 55 } 56 }; 57 58 Drupal.WeMegaMenuFrontEnd.mobileMenu = function() { 59 $('#menu-toggle').mobileMenu({ 60 pageSelector: 'body', 61 targetWrapper: '.navbar-we-mega-menu' 62 63 }); 64 }; 65 66 67 function listHeight() { 68 $(".we-mega-menu-submenu").each(function () { 69 var listHeight = 0; 70 var newHeight = 0; 71 72 $(".we-mega-menu-submenu-inner", this).each(function () { 73 var el = $(this); 74 //el.css('height', 'auto'); 75 //newHeight = el.height(); 76 newHeight = newHeight > el.height() ? newHeight : el.height(); 77 78 if (newHeight > listHeight) { 79 listHeight = newHeight; 80 } 81 }); 82 83 $(".we-mega-menu-submenu-inner", this).height(listHeight); 84 }); 85 } 86 87 $(window).on('load', function () { 88 if (!$('body').hasClass('new-style-header')) { 89 listHeight(); 90 } 91 }); 92 93 94 95})(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.