Некодим логотипНекодим
МодификацииПубликацииНекодИИмЦены
Некодим логотипНекодим

© 2020-2026 Некодим

Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.

Компания

  • Контакты
  • Публичная оферта
  • Политика конфиденциальности
  • Согласие на обработку данных
  • Лицензионное соглашение
  • Реферальная программа

Полезное

  • Модификации
  • Публикации
  • Каталог блоков Tilda
  • MCP для агентов
  • Журнал изменений
  • Доска почёта

Личный кабинет

  • Вход
  • Регистрация
  • Цены
Журнал измененийИстория GitФайлыTilda MCP
Каталог файлов

tilda-catalog-1.2.js

Код файла
Версия от 05.12.2026, 07:01:02 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
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
История файла и сравнение версий
  • 05.12.2026, 07:01:02 · 56c3b845
* Применяет к элементу цвет текста, контрастирущий цвету фона
6013 * @param {Element} textElement
6014 * @param {string} targetColor
6015 * @param {string} bgColor
6016 */
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);
6023 }
6024}
6025
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');
6037
6038 var popupBgColor;
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;
6043 }
6044
6045 if (prodName) {
6046 var titleStyle = prodName.getAttribute('style');
6047
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));
6055
6056 if (popupBgColor) {
6057 var prodNameColor = options.typo.titleColor;
6058 t_catalog_applyContrastColorIfNecessary(popupStoreProdName, prodNameColor, popupBgColor);
6059 }
6060 }
6061 }
6062
6063 var descrStyle;
6064 if (prodDescr) {
6065 descrStyle = prodDescr.getAttribute('style');
6066 }
6067
6068 if (!descrStyle && options && options.typo && options.typo.descr) {
6069 descrStyle = options.typo.descr;
6070 descrStyle = descrStyle.replace('line-height:0;', ''); // удаление нулевой межстрочной высоты, которая мешает пользователю
6071 }
6072
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));
6078
6079 if (popupBgColor) {
6080 var prodTextColor = options.typo.descrColor;
6081 t_catalog_applyContrastColorIfNecessary(popupStoreProdText, prodTextColor, popupBgColor);
6082 }
6083 }
6084}
6085
6086/**
6087 * Устанавливает стили для названия товара в сниппете
6088 * @param {HTMLElement} snippetContainer - Контейнер сниппета товара
6089 * @param {string} recid - ID записи
6090 * @param {CatalogOptions} options - Объект настроек
6091 * @param {string} [bgColor] - Цвет фона
6092 */
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;
6096
6097 if (options.title_typo) {
6098 t_catalog_parseTypoStylesConfig(
6099 recid,
6100 '.t-catalog__prod-popup__name',
Предыдущие 100 строкСледующие 100 строк