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 $('div.region-we-mega-menu a.navbar-toggle').mobileMenu(); 60 61 // $('div.region-we-mega-menu a.navbar-toggle').mobileMenu({ 62 // pageSelector: 'body', 63 // targetWrapper: '.navbar-we-mega-menu' 64 // }); 65 66 // $('#menu-toggle-wemegamenu').mobileMenu(); 67 }; 68})(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.