Каталог файловtilda-catalog-1.2.js
6001 // opts.storepart = storepartuid;6002 options.isPublishedPage = true; // hack, need fix6003 // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046)6004 // @ts-expect-error ST-2949_56005 t_catalog_loadProducts('', recidFromHistory, optsFromHistory);6006 }6007 }6008 };6009}6010 6011/**6012
История файла и сравнение версий
* Применяет к элементу цвет текста, контрастирущий цвету фона
6013 * @param {Element} textElement 6014 * @param {string} targetColor 6015 * @param {string} bgColor 6017function t_catalog_applyContrastColorIfNecessary(textElement, targetColor, bgColor) { 6018 var ligntessDiff = Math.abs(t_catalog_getLightnessColor(targetColor) - t_catalog_getLightnessColor(bgColor)); 6019 if (ligntessDiff === 0) { 6020 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) 6021 // @ts-expect-error ST-2949_1 6022 textElement.style.color = t_catalog_luma_rgb(bgColor); 6026// TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) 6027// @ts-expect-error ST-2949_2 6028function t_catalog_copyTypographyFromLeadToPopup(recid, options) { 6029 var rec = document.getElementById('rec' + recid); 6030 // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) 6031 // @ts-expect-error ST-2949_3 6032 var prodName = rec.querySelector('.js-catalog-grid-cont .js-catalog-prod-name'); 6033 // @ts-expect-error ST-2949_3 6034 var prodDescr = rec.querySelector('.js-catalog-grid-cont .js-catalog-prod-descr'); 6035 // @ts-expect-error ST-2949_3 6036 var popupContainer = rec.querySelector('.t-popup .t-popup__container'); 6039 if (popupContainer) { 6040 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) 6041 // @ts-expect-error ST-2949_1 6042 popupBgColor = popupContainer.style.backgroundColor; 6046 var titleStyle = prodName.getAttribute('style'); 6048 // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) 6049 // @ts-expect-error ST-2949_3 6050 var popupStoreProdName = rec.querySelector('.t-popup .js-catalog-prod-name'); 6051 if (popupStoreProdName) { 6052 // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046) 6053 // @ts-expect-error ST-2949_5 6054 popupStoreProdName.setAttribute('style', t_catalog_removeSizesFromStylesLine(titleStyle)); 6057 var prodNameColor = options.typo.titleColor; 6058 t_catalog_applyContrastColorIfNecessary(popupStoreProdName, prodNameColor, popupBgColor); 6065 descrStyle = prodDescr.getAttribute('style'); 6068 if (!descrStyle && options && options.typo && options.typo.descr) { 6069 descrStyle = options.typo.descr; 6070 descrStyle = descrStyle.replace('line-height:0;', ''); // удаление нулевой межстрочной высоты, которая мешает пользователю 6073 // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) 6074 // @ts-expect-error ST-2949_3 6075 var popupStoreProdText = rec.querySelector('.t-popup .js-catalog-prod-text'); 6076 if (popupStoreProdText) { 6077 popupStoreProdText.setAttribute('style', t_catalog_removeSizesFromStylesLine(descrStyle)); 6080 var prodTextColor = options.typo.descrColor; 6081 t_catalog_applyContrastColorIfNecessary(popupStoreProdText, prodTextColor, popupBgColor); 6087 * Устанавливает стили для названия товара в сниппете 6088 * @param {HTMLElement} snippetContainer - Контейнер сниппета товара 6089 * @param {string} recid - ID записи 6090 * @param {CatalogOptions} options - Объект настроек 6091 * @param {string} [bgColor] - Цвет фона 6093function t_catalog_setProductNameStyles(snippetContainer, recid, options, bgColor) { 6094 const productName = snippetContainer.querySelector('.t-catalog__prod-popup__title-wrapper .js-catalog-prod-name'); 6095 if (!productName) return; 6097 if (options.title_typo) { 6098 t_catalog_parseTypoStylesConfig( 6100 '.t-catalog__prod-popup__name',