1jQuery(document).ready(function ($) { 2 if (typeof mnyMobileMenuData === 'undefined') return; 3 4 const $overlay = $('#mny-mobile-menu'); 5 const $toggle = $('#mny-mobile-menu-toggle'); 6 const $content = $('#mny-menu-content'); 7 const $backBtn = $('#mny-back-btn'); 8 const $closeBtn = $('#mny-close-menu'); 9 const $title = $('#mny-menu-title'); 10 const $ctaContainer = $('.mny-cta-container'); 11 const $subFooter = $('#mny-sub-footer'); 12 const $subBottomList = $('#mny-sub-bottom-menu'); 13 14 let history = []; 15 let currentParentId = '0'; 16 let currentLevelTitle = 'Menu'; 17 18 let scrollPos = 0; 19 function lockScroll() { 20 scrollPos = $(window).scrollTop(); 21 $('body').css({ 22 position: 'fixed', 23 top: -scrollPos + 'px', 24 width: '100%', 25 overflow: 'hidden' 26 }); 27 } 28 29 function unlockScroll() { 30 $('body').css({ 31 position: '', 32 top: '', 33 width: '', 34 overflow: '' 35 }); 36 $(window).scrollTop(scrollPos); 37 } 38 39 40 function init() { 41 renderLevel('0', 'Menu'); 42 43 // Floating Contact Panel Toggle 44 const $contactPanel = $('#mny-contact-panel'); 45 const $contactBackdrop = $('#mny-contact-backdrop'); 46 const $contactToggle = $('#mny-contact-toggle-btn'); 47 const $contactClose = $('#mny-contact-panel-close'); 48 49 $contactToggle.on('click', function(e) { 50 e.stopPropagation(); 51 $contactPanel.toggleClass('active'); 52 $contactToggle.toggleClass('active'); 53 $contactBackdrop.toggleClass('active'); 54 }); 55 56 $contactClose.on('click', function() { 57 closeContactPanel(); 58 }); 59 60 $contactBackdrop.on('click', function() { 61 closeContactPanel(); 62 }); 63 64 function closeContactPanel() { 65 $contactPanel.removeClass('active'); 66 $contactToggle.removeClass('active'); 67 $contactBackdrop.removeClass('active'); 68 } 69 70 // Language Dropup Toggle 71 const $langBtn = $('#mny-lang-btn'); 72 const $langList = $('#mny-lang-list'); 73 74 $langBtn.on('click', function(e) { 75 e.stopPropagation(); 76 $langList.toggleClass('active'); 77 }); 78 79 $(document).on('click', function(e) { 80 if (!$langBtn.is(e.target) && $langBtn.has(e.target).length === 0 && !$langList.is(e.target) && $langList.has(e.target).length === 0) { 81 $langList.removeClass('active'); 82 } 83 }); 84 85 $toggle.on('click', function () { 86 if ($overlay.hasClass('active')) { 87 closeMenu(); 88 } else { 89 // Dynamic Top Position: start exactly below the header/wrapper 90 const wrapper = document.querySelector('.mny-sh-wrapper'); 91 if (wrapper) { 92 const rect = wrapper.getBoundingClientRect(); 93 const topOffset = rect.bottom + 17; 94 $overlay.css('top', topOffset + 'px'); 95 } 96 97 $overlay.addClass('active'); 98 $toggle.addClass('active'); 99 lockScroll(); 100 } 101 }); 102 103 $closeBtn.on('click', function () { 104 closeMenu(); 105 }); 106 107 $backBtn.on('click', function () { 108 goBack(); 109 }); 110 111 $(document).on('click', '.mny-menu-link-parent', function (e) { 112 e.preventDefault(); 113 const id = $(this).data('id'); 114 const title = $(this).find('.mny-item-text').text(); 115 navigateTo(id, title); 116 }); 117 } 118 119 function renderLevel(parentId, title) { 120 $content.addClass('mny-fadeOut'); 121 122 setTimeout(() => { 123 $content.empty(); 124 const items = mnyMobileMenuData.menuItems.filter(item => item.parent == parentId); 125 126 if (items.length > 0) { 127 console.log('Rendering level:', parentId, title, items); 128 129 // Add "Go to Parent" row if parentId is not 0 and parent has a real URL (Option 2) 130 if (parentId !== '0') { 131 const parentItem = mnyMobileMenuData.menuItems.find(item => item.id == parentId); 132 const isRealUrl = parentItem && parentItem.url && parentItem.url.trim() !== '' && parentItem.url.trim() !== '#' && !parentItem.url.trim().startsWith('javascript:'); 133 if (isRealUrl) { 134 const isTr = window.location.pathname.includes('/tr/') || (typeof ICL_LANGUAGE_CODE !== 'undefined' && ICL_LANGUAGE_CODE === 'tr'); 135 const goLabel = isTr ? `${parentItem.title} sayfasına git` : `Go to ${parentItem.title}`; 136 const $goRow = $(` 137 <div class="mny-parent-go-row"> 138 <a href="${parentItem.url}" target="${parentItem.target || '_self'}" class="mny-parent-go-link">
139 <span class="mny-parent-go-text">${goLabel}</span> 140 <img src="${mnyMobileMenuData.pluginUrl}assets/images/right-arrow.svg" class="mny-parent-go-arrow" alt="Go"> 141 </a> 142 </div> 143 `); 144 $content.append($goRow); 145 } 146 } 147 148 const $ul = $('<ul class="mny-menu-list"></ul>'); 149 150 // Design rule: if we are inside "Services", add has-border class 151 const isInsideServices = title.toLowerCase().includes('services'); 152 153 items.forEach(item => { 154 const hasChildren = mnyMobileMenuData.menuItems.some(child => child.parent == item.id); 155 const $li = $('<li class="mny-menu-item"></li>'); 156 157 let linkClasses = 'mny-menu-link'; 158 if (hasChildren) linkClasses += ' mny-menu-link-parent'; 159 if (parentId !== '0') linkClasses += ' mny-sub-link'; 160 if (isInsideServices && parentId !== '0') linkClasses += ' has-border'; 161 162 const $a = $(`<a href="${item.url}" class="${linkClasses}" data-id="${item.id}" target="${item.target}"></a>`); 163 164 $a.append(`<span class="mny-item-text">${item.title}</span>`); 165 166 if (hasChildren) { 167 $a.append(`<img src="${mnyMobileMenuData.pluginUrl}assets/images/right-arrow.svg" class="mny-item-arrow" alt="Next">`); 168 } 169 170 $li.append($a); 171 $ul.append($li); 172 }); 173 $content.append($ul); 174 } 175 176 $content.removeClass('mny-fadeOut').addClass('mny-animate-fade-in'); 177 178 // Header / Footer updates 179 $title.text(title); 180 181 if (parentId == '0') { 182 $('.mny-menu-header').hide(); 183 } else { 184 $('.mny-menu-header').show(); 185 } 186 }, 200); 187 } 188 189 function navigateTo(id, title) { 190 history.push({ id: currentParentId, title: $title.text() }); 191 currentParentId = id; 192 renderLevel(id, title); 193 } 194 195 function goBack() { 196 if (history.length > 0) { 197 const prevState = history.pop(); 198 currentParentId = prevState.id; 199 renderLevel(currentParentId, prevState.title); 200 } 201 } 202 203 function closeMenu() { 204 $overlay.removeClass('active'); 205 $toggle.removeClass('active'); 206 unlockScroll(); 207 resetMenu(); 208 } 209 210 function resetMenu() { 211 history = []; 212 currentParentId = '0'; 213 renderLevel('0', 'Menu'); 214 } 215
216 function renderSubBottomMenu() { 217 if (mnyMobileMenuData.subBottomItems && mnyMobileMenuData.subBottomItems.length > 0) { 218 $subBottomList.empty(); 219 mnyMobileMenuData.subBottomItems.forEach((item, index) => { 220 $subBottomList.append(`<a href="${item.url}" class="mny-sub-footer-link" target="${item.target}">${item.title}</a>`); 221 if (index < mnyMobileMenuData.subBottomItems.length - 1) { 222 $subBottomList.append('<span class="mny-footer-dot"></span>'); 223 } 224 }); 225 } 226 } 227 228 init(); 229});
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.