801802/**803* Возвращает вертикальный отступ. Если он не был задан пользователем,804* возвращается дефолтное значение - 25px.805*806* @param {number} verticalIndent807* @return {number}808*/809function t_submenublocks__getCurrentVerticalIndent(verticalIndent) {810if (!verticalIndent) return 25;811var cornerSize = 10;812return verticalIndent + cornerSize;
}/** * @return {Boolean} */function t_submenublocks__checkOnlyScalableBrowser() { if (typeof window.t396_isOnlyScalableBrowser !== 'function') return false; return window.t396_isOnlyScalableBrowser();}function t_submenublocks__processSubmenuHeight(submenu, submenuMenu, selector, state, isBottomMenu) { if (!submenuMenu) return; var isMobile = window.innerWidth <= 980; // для случаев, когда эта функция вызывается из скрипта блока ME601b для меню третьего уровня if (isMobile && selector === '.t978') submenuMenu = submenu.querySelector('.t978__content'); submenuMenu.style.height = ''; var isFixedSubmenu = submenu.style.position === 'fixed'; if (state === 'close' || (isMobile && !isFixedSubmenu)) { submenuMenu.style.overflowY = ''; return; } var submenuStyles = submenu.getBoundingClientRect(); var windowHeight = isMobile ? document.documentElement.clientHeight : window.innerHeight; var paddingFromWindow = 40; var submenuMaxHeight = windowHeight - paddingFromWindow; if (isBottomMenu) { submenuMaxHeight -= windowHeight - submenuStyles.bottom; } else { submenuMaxHeight -= submenuStyles.top > 0 ? submenuStyles.top : submenuStyles.bottom; } var submenuFitsIntoScreen = submenuStyles.height <= submenuMaxHeight; if (submenuFitsIntoScreen || (submenuStyles.bottom < windowHeight && submenuStyles.top > 0)) return; submenuMenu.style.height = submenuMaxHeight + 'px'; submenuMenu.style.overflowY = 'scroll';}/** * * @param {HTMLElement} anchor * @return {HTMLElement | null} */function t_submenublocks__getZeroBottomMenu(anchor) { var artBoard = anchor ? anchor.closest('.t396__artboard') : null; if (!artBoard || typeof window.t396_ab__getFieldValue !== 'function') return null; var isFixedZero = window.t396_ab__getFieldValue(artBoard, 'pos') === 'fixed'; var isFixedBottomZero = window.t396_ab__getFieldValue(artBoard, 'fixed-pos') === 'bottom'; return isFixedZero && isFixedBottomZero ? artBoard : null;}function t_submenublocks__hideSubmenu(submenu, selector) { if (!submenu || submenu.closest('.t-submenu_fullscreen')) return; var isME601B = selector === '.t978'; if (submenu.getAttribute('data-mobiletooltip') === 'yes') submenu.setAttribute('data-mobiletooltip', ''); if (submenu.classList.contains(selector.slice(1) + '__tooltip-menu_mobile')) { t_submenublocks__slideUp(submenu, 300, function () { t_submenublocks__removeEl(submenu); t_triggerEvent(submenu, 'menuOverflow'); t_triggerEvent(submenu, 'submenuHide'); }); } else { var content = submenu ? submenu.querySelector(selector.slice(1) + '__content') : null; submenu.style.display = ''; submenu.style.left = ''; submenu.style.right = ''; submenu.style.top = ''; submenu.style.width = ''; submenu.style.maxWidth = ''; if (content) { content.style.overflowY = ''; content.style.height = ''; } if (isME601B) { var menu = submenu.querySelector(selector + '__menu'); var corner = submenu.querySelector(selector + '__tooltip-menu-corner'); var cornerBorder = submenu.querySelector(selector + '__tooltip-menu-corner-border'); if (menu) menu.style.order = ''; if (corner) { corner.style.left = '';