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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-catalog-1.2.js

Код файла
Версия от 05.12.2026, 07:01:02 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
1001	if (styles.colorhover) {1002		// @ts-expect-error ST-2949_21003		t_catalog_addTextColorRule(textHoverRules, styles.colorhover);1004	}1005	if (styles.color_res_480) {1006		// @ts-expect-error ST-2949_21007		t_catalog_addTextColorRule(textMobileRules, styles.color_res_480);1008	}1009 1010	// 	Селектор кнопки в для карточке товара и в секции Смотрите также1011	const textBtnSelector = `${itemSelector} .t-btnflex__text, ${itemSelector} .t-catalog__card__btn-text`;1012
История файла и сравнение версий
  • 05.12.2026, 07:01:02 · 56c3b845
const textBtnHoverSelector = `${itemSelector}:hover .t-btnflex__text, ${itemSelector}:hover .t-catalog__card__btn-text`;
1013 let css = '';
1014
1015 if (textBaseRules?.length) {
1016 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)
1017 // @ts-expect-error ST-2949_2
1018 css += `${textBtnSelector}{${textBaseRules.join('')}}`;
1019 }
1020
1021 if (textHoverRules?.length) {
1022 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)
1023 // @ts-expect-error ST-2949_2
1024 css += `\n${textBtnHoverSelector}{${textHoverRules.join('')}}`;
1025 }
1026
1027 if (textMobileRules?.length) {
1028 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)
1029 // @ts-expect-error ST-2949_2
1030 css += `\n@media screen and (max-width:480px){${textBtnSelector}{${textMobileRules.join('')}}}`;
1031 }
1032
1033 return css;
1034}
1035
1036/**
1037 * Создает CSS для внешнего вида кнопки
1038 * @param {string} recid
1039 * @param {string} itemSelector
1040 * @param {Record<string, string>} styles
1041 * @param {string[]} excludedStyles
1042 * @returns {string}
1043 */
1044function t_catalog_createButtonAppereanceCss(recid, itemSelector, styles, excludedStyles) {
1045 // Универсальная схема маппинга: ключ конфига -> CSS свойство
1046 const cssPropertiesMap = {
1047 bgcolor: 'background-color',
1048 radius: 'border-radius',
1049 wrap: 'white-space',
1050 shadow: 'box-shadow',
1051 fontweight: 'font-weight',
1052 uppercase: 'text-transform',
1053 fontsize: 'font-size',
1054 fontfamily: 'font-family',
1055 lineheight: 'line-height',
1056 letterspacing: 'letter-spacing',
1057 gap: 'gap',
1058 padding: 'padding',
1059 iconposition: 'flex-direction',
1060 };
1061
1062 if (Array.isArray(excludedStyles) && excludedStyles.length) {
1063 const excludedStylesSet = new Set(excludedStyles);
1064
1065 for (const key in cssPropertiesMap) {
1066 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)
1067 // @ts-expect-error ST-2949_2
1068 if (excludedStylesSet.has(key)) delete cssPropertiesMap[key];
1069 }
1070 }
1071
1072 // Построение базовых, hover и мобильных правил
1073 const baseRules = t_catalog_buildBaseButtonCssRules(cssPropertiesMap, styles);
1074 const hoverRules = t_catalog_buildHoverCssRules(styles);
1075 const mobileRules = t_catalog_buildMobileCssRules(cssPropertiesMap, styles);
1076
1077 const selector = `#rec${recid} ${itemSelector}`;
1078 const hoverSelector = `#rec${recid} ${itemSelector}:hover`;
1079 let css = '';
1080
1081 if (baseRules?.length) {
1082 css += `${selector}{${baseRules.join('')}}`;
1083 }
1084
1085 if (hoverRules?.length) {
1086 css += `\n${hoverSelector}{${hoverRules.join('')}}`;
1087 }
1088
1089 if (mobileRules?.length) {
1090 css += `\n@media screen and (max-width:480px){${selector}{${mobileRules.join('')}}}`;
1091 }
1092
1093 return css;
1094}
1095
1096/**
1097 * Создает тег CSS-стилей
1098 * @param {string} styleId
1099 * @param {string} css
1100 */
Предыдущие 100 строкСледующие 100 строк