2801setTimeout(() => {2802// добавляем задержку, чтобы учесть кейс, когда мы проверяем ширину колонки с базовым шрифтом2803// а потом подгружается реальный шрифт (который может быть больше/меньше чем базовый)2804t_catalog_unifyCardsWidth(recid);2805}, 1000);2806}28072808if (!options.previewmode) {2809try {2810/* TODO: fix */28112812// TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538)
// @ts-expect-error ST-2949_3 window.tp__record__addEditFieldEvents(recid); } catch (e) { // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046) // @ts-expect-error ST-2949_5 console.error(e.message); } }}/** * Append products to the grid container and show them * * @param {HTMLElement} el_rec * @param {HTMLElement} gridContainer - the grid container where the products will be appended * @param {string} productsHtml - the HTML of the products to be appended to the grid **/function t_catalog_process_appendAndShowProducts(el_rec, gridContainer, productsHtml) { gridContainer.insertAdjacentHTML('beforeend', productsHtml); hydrateCatalogGalleries(gridContainer); // TODO ST-2949_6: operators / arithmetic / unintentional comparison (TS2362, TS2365, TS2367) // @ts-expect-error ST-2949_6 if (el_rec.getAttribute('data-already-loaded-first-products') === true) { // products in pagination and in tabs we show with transition setTimeout(function () { Array.prototype.forEach.call(el_rec.querySelectorAll('.t-catalog__card'), function (card) { card.classList.remove('t-catalog__card_hidden'); }); t_catalog__updateBgUpOverlayOffsets(el_rec); }, 10); } else { // first products we show without transition Array.prototype.forEach.call(el_rec.querySelectorAll('.t-catalog__card'), function (card) { card.classList.remove('t-catalog__card_hidden'); }); // flag, that next loaded products wouldn't be first for this rec // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046) // @ts-expect-error ST-2949_5 el_rec.setAttribute('data-already-loaded-first-products', true); t_catalog__updateBgUpOverlayOffsets(el_rec); }}/** * Checks if the load button is visible and if it is, it hides it * * @param {string} recid * @param {object} options **/function t_catalog_mobileHoriz_checkBtnVisibility(recid, options) { // 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 var hideLoadBtn = function (recid, opts) { var rec = document.getElementById('rec' + recid); if (window.innerWidth < 960 && opts.hasMobileHorizScroll) { // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 var loadMoreBtn = rec.querySelector('.js-catalog-load-more-btn'); // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046) // @ts-expect-error ST-2949_5 t_catalog__removeElement(loadMoreBtn); } }; hideLoadBtn(recid, options); t_onFuncLoad('t_throttle', function () { window.addEventListener( 'resize', t_throttle(function () { hideLoadBtn(recid, options); }, 500) ); });}/** * Make popup window that appears when you click on a product * * @param {string} recid * @param {CatalogOptions} options * @returns {string} - HTML of popup **/function t_catalog_get_productPopup_html(recid, options) { var str = ''; // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 var statAttr = options.popup_opts.popupStat ? 'data-track-popup="' + options.popup_opts.popupStat + '"' : ''; // @ts-expect-error ST-2949_3