1/* global woodmart_settings */ 2(function($) { 3 woodmartThemeModule.menuSetUp = function() { 4 var hasChildClass = 'menu-item-has-children', 5 mainMenu = $('.wd-nav, .wd-header-cats'), 6 openedClass = 'wd-opened'; 7 8 $('.mobile-nav').find('ul.wd-nav-mobile').find(' > li').has('.wd-dropdown-menu').addClass(hasChildClass); 9 10 woodmartThemeModule.$document.on('click', '.wd-nav .wd-event-click > a, .wd-header-cats.wd-event-click > span', function(e) { 11 e.preventDefault(); 12 var $this = $(this); 13 14 if ($this.parent().siblings().hasClass(openedClass)) { 15 $this.parent().siblings().removeClass(openedClass); 16 } 17 18 $this.parent().toggleClass(openedClass); 19 }); 20 21 woodmartThemeModule.$document.on('click', function(e) { 22 var target = e.target; 23 24 if ($('.' + openedClass).length > 0 && !$(target).is('.wd-event-hover') && !$(target).parents().is('.wd-event-hover') && !$(target).parents().is('.' + openedClass + '') && !$(target).is('.' + openedClass + '') && ! target.closest('.wd-cookies-popup') && 0 === $('.mfp-ready').length && 0 === $('.pswp--open').length) { 25 mainMenu.find('.wd-event-click.' + openedClass + '').removeClass(openedClass); 26 27 if (mainMenu.hasClass('wd-event-click')) { 28 mainMenu.removeClass(openedClass); 29 } 30 31 $('.wd-close-side').removeClass('wd-close-side-opened wd-location-header'); 32 } 33 }); 34 35 if ('yes' === woodmart_settings.menu_item_hover_to_click_on_responsive) { 36 function menuIpadClick() { 37 if (woodmartThemeModule.$window.width() <= 1024) { 38 mainMenu.find(' > .menu-item-has-children.wd-event-hover').each(function() { 39 $(this).data('original-event', 'hover').removeClass('wd-event-hover').addClass('wd-event-click'); 40 }); 41 } else { 42 mainMenu.find(' > .wd-event-click').each(function() { 43 var $this = $(this); 44 45 if ($this.data('original-event') === 'hover') { 46 $this.removeClass('wd-event-click').addClass('wd-event-hover'); 47 } 48 }); 49 } 50 } 51 52 menuIpadClick(); 53 54 woodmartThemeModule.$window.on('resize', woodmartThemeModule.debounce(function() { 55 menuIpadClick(); 56 }, 300)); 57 } 58 }; 59 60 ['wdEventStarted', 'wdUpdatedHeader'].forEach((eventName) => { 61 window.addEventListener(eventName, function () { 62 woodmartThemeModule.menuSetUp(); 63 }); 64 }); 65})(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.