101const wishlistErrorText =102window.browserLang === 'RU'103? 'Ошибка: На странице отсутствует виджет избранного (блок ST110). Пожалуйста, добавьте его.'104: 'Error: favorites widget (block ST110) is not added to this page.';105106wishlistIcons.forEach(function (icon) {107icon.addEventListener('click', function (event) {108event.preventDefault();109110if (!document.querySelector('.t-menuwidgeticons__favorites-error')) {111t_menuWidgets__showError('favorites', wishlistErrorText);112
} }); }); }}function t_menuWidgets__handledMembersIcon(rec, menuEl) { const buyerDashboardScript = document.querySelector('script[src*="tilda-buyer-dashboard"]'); const lkDashboardScript = document.querySelector('script[src*="tilda-lk-dashboard"]'); const showMembersIcon = menuEl.getAttribute('data-menu-widgeticon-members') === 'yes'; if (!window.tildaMembers && !buyerDashboardScript && !lkDashboardScript && showMembersIcon) { const memberIcons = rec.querySelectorAll('.t-menuwidgeticons__link_members'); const membersErrorText = window.browserLang === 'RU' ? 'Ошибка: В проекте отсутствует модуль Личного кабинета. Пожалуйста, подключите его.' : 'Error: there is no Members module in the project. Please connect it.'; memberIcons.forEach(function (icon) { icon.addEventListener('click', function (event) { event.preventDefault(); if (!document.querySelector('.t-menuwidgeticons__members-error')) { t_menuWidgets__showError('members', membersErrorText); } }); }); }}function t_menuWidgets__getVisibleMenu(rec) { const windowWidth = window.innerWidth; const screenMin = rec.getAttribute('data-screen-min'); const screenMax = rec.getAttribute('data-screen-max'); if (screenMin && windowWidth < parseInt(screenMin, 10)) return false; if (screenMax && windowWidth > parseInt(screenMax, 10)) return false; return true;}function t_menuWidgets__hideWidgetButtons(recId, menuEl) { const rec = document.querySelector('#rec' + recId); const hideWidgetClass = 't-menuwidgeticons__button_hidden_' + recId; const isVisibleMenu = t_menuWidgets__getVisibleMenu(rec); const icons = [ { element: document.querySelector('.t985__search-widget-button'), isExsists: menuEl.getAttribute('data-menu-widgeticon-search') === 'yes', }, { element: document.querySelector('.t706__carticon'), isExsists: menuEl.getAttribute('data-menu-widgeticon-cart') === 'yes', }, { element: document.querySelector('.t1002__wishlisticon'), isExsists: menuEl.getAttribute('data-menu-widgeticon-wishlist') === 'yes', }, ]; icons.forEach(function (icon) { if (!icon.element || !icon.isExsists) return; isVisibleMenu ? icon.element.classList.add(hideWidgetClass) : icon.element.classList.remove(hideWidgetClass); });}function t_menuWidgets__showError(type, text) { const shownErrors = document.querySelectorAll('.t-menuwidgeticons__error'); let errorTopPos; if (shownErrors.length > 0) { const lastError = shownErrors[shownErrors.length - 1]; errorTopPos = parseInt(window.getComputedStyle(lastError).top) + parseInt(window.getComputedStyle(lastError).height) + 20; } const html = t_menuWidgets__getErrorHtml(type, text); document.body.classList.add('t-menuwidgeticons__body-error_showed'); document.body.insertAdjacentHTML('beforeend', html); const currentError = document.querySelector('.t-menuwidgeticons__' + type + '-error'); setTimeout(function () { currentError.style.transition = 'opacity .4s, right .4s';