1(function ($) { 2 "use strict"; 3 4 function initTcgelementsMenuList() { 5 // Add menu item icons (before dropdown icons) 6 $('.tcgelements-menu-list ul .menu-item a').each(function () { 7 let $link = $(this); 8 let $menuList = $link.closest('.tcgelements-menu-list'); 9 let menuItemIconHtml = $menuList.data('menu-item-icon'); 10 11 // Only add if icon doesn't already exist and we have an icon to add 12 if (menuItemIconHtml && $link.find('.menu-item-icon').length === 0) { 13 // Wrap the icon in a span for better styling control 14 $link.prepend('<span class="menu-item-icon">' + menuItemIconHtml + '</span>'); 15 } 16 }); 17 18 // Existing dropdown icons code 19 $('.tcgelements-menu-list ul > .menu-item-has-children > a').each(function () { 20 let iconHtml = $(this).closest('.tcgelements-menu-list').data('dropdown-icon'); 21 // Avoid appending if a dropdown icon already exists 22 if ($(this).find('.dropdown-icon').length === 0) { 23 if ($(this).siblings('.sub-menu').length > 0) { 24 if (iconHtml) { 25 $(this).append('<span class="dropdown-icon">' + iconHtml + '</span>'); 26 } else { 27 $(this).append('<span class="dropdown-icon"><i class="fas fa-chevron-down"></i></span>'); 28 } 29 } 30 } 31 }); 32 33 // Update click handler to target the dropdown icon specifically 34 $('.tcgelements-menu-list ul > .menu-item-has-children > a').off('click').on('click', function (e) { 35 e.preventDefault(); 36 e.stopPropagation(); 37 38 let $dropdownIcon = $(this).find('.dropdown-icon i, .dropdown-icon svg'); 39 let $subMenu = $(this).siblings('.sub-menu'); 40 let $menuItem = $(this).parent(); 41 42 if ($subMenu.hasClass('sub-open')) { 43 $subMenu.removeClass('sub-open'); 44 $menuItem.removeClass('sub-menu-open'); 45 if ($dropdownIcon.is('i')) { 46 $dropdownIcon.removeClass('fa-chevron-up').addClass('fa-chevron-down'); 47 } else if ($dropdownIcon.is('svg')) { 48 let iconHtml = $(this).closest('.tcgelements-menu-list').data('dropdown-icon'); 49 $dropdownIcon.replaceWith(iconHtml); 50 } 51 } else { 52 $subMenu.addClass('sub-open'); 53 $menuItem.addClass('sub-menu-open'); 54 if ($dropdownIcon.is('i')) { 55 $dropdownIcon.removeClass('fa-chevron-down').addClass('fa-chevron-up'); 56 } else if ($dropdownIcon.is('svg')) { 57 let activeIconHtml = $(this).closest('.tcgelements-menu-list').data('dropdown-icon-active'); 58 $dropdownIcon.replaceWith(activeIconHtml); 59 } 60 } 61 }); 62 63 // Existing hover animation code... 64 if ($('.tcgelements-menu-list.hover-animation').length) { 65 $('.tcgelements-menu-list.hover-animation > div > ul > .menu-item > a').each(function () { 66 $(this).attr('data-text', $(this).text().trim()); 67 $(this).addClass('fill-text'); 68 }); 69 } 70 71 $('.tcgelements-menu-list.hover-animation ul > .menu-item').on('mouseenter', function () { 72 $(this).removeClass('hoverd').siblings().addClass('hoverd'); 73 }); 74 75 $('.tcgelements-menu-list.hover-animation ul > .menu-item').on('mouseleave', function () { 76 $(this).removeClass('hoverd').siblings().removeClass('hoverd'); 77 }); 78 } 79 80 // Initialize in frontend 81 $(window).on('elementor/frontend/init', function () { 82 elementorFrontend.hooks.addAction('frontend/element_ready/tcgelements-menu-list.default', initTcgelementsMenuList); 83 84 if (elementorFrontend.isEditMode()) { 85 initTcgelementsMenuList(); 86 } 87 });
88 89 if (typeof elementorFrontend === 'undefined' || !elementorFrontend.isEditMode()) { 90 initTcgelementsMenuList(); 91 } 92 93})(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.