5501// В словаре значение хранится в одном написании, у товара может быть иначе ("Красный" и "красный")5502var itemName = String(item.value).trim().toLowerCase();5503var valueName = value == null ? '' : String(value).trim().toLowerCase();5504if (itemName === valueName) {5505result = item.color;5506break;5507}5508}55095510return result;5511}5512
// 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_2function t_catalog_option_getClassModificator(curOption, type, className) { // Add class modificators for both filters and options if (!curOption) { return ''; } var params = curOption.params; var result = className + '_' + params.view; if (params.hasColor && params.linkImage) { // If product options has both color and image, design for filters and options differ if (type === 'filter') { result = className + '_buttons'; result += ' ' + className + '_color'; } else { result += ' ' + className + '_image'; } } else if (params.hasColor) { if (type === 'filter') { result = className + '_buttons'; } result += ' ' + className + '_color'; } else if (params.linkImage) { result += ' ' + className + '_image'; } else { result += ' ' + className + '_simple'; } return result;}// 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_2function t_catalog_checkUrl(options, recid) { // TODO АЛИАС: При вклюении алиасов тут необходимы доработки // ST-1536 Алиасы в каталоге https://yt.tilda.team/issue/ST-1536/Aliasy-v-kataloge var currentUrl = window.location.href; var splitProductUrl = t_catalog__splitProductUrl(currentUrl); if (splitProductUrl) { var urlHash = splitProductUrl.hash; var prodDataArr = urlHash.split('-'); if (typeof prodDataArr[1] === 'undefined') { return; } var curProdUid = prodDataArr[1]; var rec = document.getElementById('rec' + recid); // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 var prod = rec.querySelector('.js-catalog-grid-cont [data-product-gen-uid="' + curProdUid + '"]'); // @ts-expect-error ST-2949_3 var el_popup = rec.querySelector('.t-popup'); if (urlHash.indexOf(recid) >= 0 && prod) { // if product exists among products list at slice 1, we trigger click // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 if (!el_popup.classList.contains('t-popup_show')) { var prodPopupBtn = prod.querySelector('[href^="#prodpopup"]'); if (prodPopupBtn) { // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) // @ts-expect-error ST-2949_1 prodPopupBtn.click(); } } // scroll to product // work incorrect, need fix // var prodOffset = prod.offset().top; // $(window).scrollTop(prodOffset - 100); } else if (urlHash.indexOf(recid) >= 0 && el_popup) { if (el_popup.classList.contains('t-popup_show')) { return; } // if product doesn't exist among products list at slice 1, we load it separately var isSnippet = document.getElementById('allrecords') !== document.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(document.querySelector('.t-catalog__product-snippet')); if (!isSnippet) { // 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 onDone = function (data) { if (typeof data === 'string' && data.substring(0, 1) === '{') { var productObj; try { var dataObj = JSON.parse(data);