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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-cart-1.1.js

Код файла
Версия от 04.12.2026, 04:03:54 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
1101						if (imgLinkArr[0] && imgLinkArr[1]) {1102							if (imgLinkArr[0] == 'image' && imgLinkArr[1].indexOf('.tildacdn.') > 0) {1103								img = imgLinkArr[1];1104							}1105						}1106					}1107				}1108 1109				if (recid == '') {1110					recid = cartBtn.closest('.r')?.getAttribute('id')1111						? cartBtn.closest('.r')?.getAttribute('id')?.replace('rec', '')1112
История файла и сравнение версий
  • 04.12.2026, 04:03:54 · 56c3b845
: '';
1113 }
1114 }
1115 }
1116
1117 var productElement = cartBtn.closest('.js-product');
1118 if (productElement) {
1119 if (name == '') {
1120 var elementName = productElement.querySelector('.js-product-name');
1121 name = elementName ? elementName.textContent.trim() : '';
1122 }
1123 var currentPrice = typeof cleanedPrice === 'undefined' ? price : cleanedPrice;
1124 if (currentPrice == '' || currentPrice == 0) {
1125 var elementPrice = productElement.querySelector('.js-product-price');
1126 if (elementPrice) {
1127 if (
1128 elementPrice.classList.contains('js-catalog-prod-price-range-val') ||
1129 elementPrice.classList.contains('js-store-prod-price-range-val')
1130 ) {
1131 price = elementPrice.getAttribute('data-product-price-range-val');
1132 } else {
1133 price = elementPrice.textContent;
1134 }
1135 }
1136 // Без элемента цены очищается текущее значение, как раньше
1137 cleanedPrice = tcart__cleanPrice(elementPrice ? price : currentPrice);
1138 }
1139 if (img == '') {
1140 if (productElement.getAttribute('data-product-img')) {
1141 img = productElement.getAttribute('data-product-img');
1142 } else {
1143 var imgDiv = productElement.querySelector('.js-product-img');
1144 if (imgDiv) {
1145 var original = imgDiv.getAttribute('data-original') || '';
1146 if (original.length > 0) {
1147 img = original;
1148 } else if (imgDiv.tagName == 'IMG') {
1149 img = imgDiv.getAttribute('src');
1150 } else if (imgDiv.tagName == 'DIV') {
1151 img = '';
1152 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)
1153 // @ts-expect-error ST-2949_2
1154 var imgCss = getComputedStyle(imgDiv)['background-image'];
1155 if (imgCss) {
1156 img = imgCss.replace('url(', '').replace(')', '').replace(/"/gi, '');
1157 }
1158 }
1159 }
1160 }
1161 }
1162 if (lid == '') {
1163 lid = productElement.getAttribute('data-product-lid') || '';
1164 }
1165 if (uid == '') {
1166 uid = productElement.getAttribute('data-product-uid') || '';
1167 }
1168 if (recid == '') {
1169 var recidAttr = productElement.closest('.r').getAttribute('id');
1170 recid = recidAttr ? recidAttr.replace('rec', '') : '';
1171 }
1172
1173 if (inv == '') {
1174 inv = productElement.getAttribute('data-product-inv') || '';
1175 }
1176
1177 unit = productElement.getAttribute('data-product-unit') || '';
1178 portion = productElement.getAttribute('data-product-portion') || '';
1179 single = productElement.getAttribute('data-product-single') || '';
1180
1181 // варианты товара (с разными свойствами)
1182 var editionOptionsElements = productElement.querySelectorAll('.js-product-edition-option');
1183 Array.prototype.forEach.call(editionOptionsElements, function (optionsElement) {
1184 var optionName = optionsElement.querySelector('.js-product-edition-option-name').textContent;
1185 var selectedOption = optionsElement.querySelector('option:checked');
1186 if (selectedOption) {
1187 var optionVariant = selectedOption.value;
1188
1189 if (optionName && optionVariant) {
1190 var optionObj = {};
1191 if (optionName != '') {
1192 optionName = tcart__escapeHtml(optionName);
1193 }
1194 if (optionVariant != '') {
1195 optionVariant = tcart__escapeHtml(optionVariant);
1196 optionVariant = optionVariant.replace(/(?:\r\n|\r|\n)/g, '');
1197 }
1198 if (optionName.length > 1 && optionName.slice(-1) == ':') {
1199 optionName = optionName.slice(0, -1);
1200 }
Предыдущие 100 строкСледующие 100 строк