10401optionVariant = optionVariant.replace(/(?:\r\n|\r|\n)/g, '');10402}1040310404var optionPrice = checkbox.getAttribute('data-product-variant-price');10405if (optionPrice) {10406optionPrice = parseFloat(optionPrice);10407}1040810409var optionObj = {10410option: optionName,10411variant: optionVariant,10412
price: optionPrice, }; options.push(optionObj); }); }); // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) // @ts-expect-error ST-2949_2 return options;/** * Настраивает фиксированную кнопку * * @param {string} recId * @param {Object} options * @return {void} */function t_catalog_fixedPopupButton(recId, options) { var rec = document.getElementById('rec' + recId); if (!rec) return; var ADDITIONAL_POPUP_HEIGHT = 130; var BTN_WRAPPER_HEIGHT = 90; var MOBILE_MAX_WIDTH = 560; var FIXED_BTN_CLASS = 't-catalog__prod-popup__btn-wrapper-fixed'; // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) // @ts-expect-error ST-2949_1 var bgColor = options?.popup_opts?.containerBgColor; var btnWrappers = rec.querySelectorAll('.t-catalog__prod-popup__btn-wrapper'); Array.prototype.forEach.call(btnWrappers, function (el) { el.classList.add(FIXED_BTN_CLASS); if (bgColor) { el.style.background = bgColor; } }); var isSnippet = document.getElementById('allrecords') !== rec.querySelector('.t-catalog__product-snippet') && // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 document.getElementById('allrecords').contains(rec.querySelector('.t-catalog__product-snippet')); // если это попап, а не отдельная страница с товаром (сниппет), то добавляем слушателей событий открытия/закрытия попапа и дополнительные стили if (!isSnippet) { var popup = rec.querySelector('.t-popup'); // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 var popupContainer = popup.querySelector('.t-popup__container'); var addStyle = function () { // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) // @ts-expect-error ST-2949_1 popupContainer.style.paddingBottom = BTN_WRAPPER_HEIGHT + ADDITIONAL_POPUP_HEIGHT + 'px'; // @ts-expect-error ST-2949_1 popupContainer.style.cssText += ';transform:none !important;'; }; var resetStyle = function () { // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) // @ts-expect-error ST-2949_1 popupContainer.style.paddingBottom = ''; // @ts-expect-error ST-2949_1 popupContainer.style.transform = ''; }; var handleResize = function () { if (window.innerWidth > MOBILE_MAX_WIDTH) { resetStyle(); return; } addStyle(); }; if (window.isMobile) { window.addEventListener('orientationchange', handleResize); } // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 popup.addEventListener(t_catalog_POPUP_SHOWED_EVENT_NAME, function () { setTimeout(function () { handleResize(); }, 0); }); // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538)