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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-catalog-1.2.js

Код файла
Версия от 05.12.2026, 07:01:02 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
5201}5202 5203/**5204 * Функция для применения аналогичных кнопке покупки эффектов к кнопке из блока ST6005205 *5206 * @param {HTMLElement} popup5207 **/5208function t_catalog_notifyButton_applyEffects(popup) {5209	var buyBtn = popup.querySelector('.t_catalog__prod-popup__btn-replaced');5210	if (!buyBtn) return;5211	var buyBtnEffects = buyBtn?.querySelector('.t-btn_wrap-effects') || buyBtn?.querySelector('.t-btn-effects');5212
История файла и сравнение версий
  • 05.12.2026, 07:01:02 · 56c3b845
if (!buyBtnEffects) return;
5213 var notifyBtn = buyBtn.nextElementSibling;
5214 var notifyBtnEffects =
5215 notifyBtn?.querySelector('.t-btn_wrap-effects') || notifyBtn?.querySelector('.t-btn-effects');
5216 if (!notifyBtnEffects) {
5217 // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538)
5218 // @ts-expect-error ST-2949_3
5219 notifyBtn.appendChild(buyBtnEffects.cloneNode(true));
5220 }
5221}
5222
5223/**
5224 * This function is used to display the product text and characteristics in the product popup.
5225 *
5226 * @param {HTMLElement} el_popup - the popup element
5227 * @param {object} product - options of product
5228 **/
5229function t_catalog_initTextAndCharacteristics(el_popup, product) {
5230 var isSnippet =
5231 document.getElementById('allrecords') !== document.querySelector('.t-catalog__product-snippet') &&
5232 // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538)
5233 // @ts-expect-error ST-2949_3
5234 document.getElementById('allrecords').contains(document.querySelector('.t-catalog__product-snippet'));
5235 var el_prodTxt = el_popup.querySelector('.js-catalog-prod-text');
5236 if (el_prodTxt) {
5237 while (el_prodTxt.firstChild) {
5238 el_prodTxt.removeChild(el_prodTxt.firstChild);
5239 }
5240 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)
5241 // @ts-expect-error ST-2949_1
5242 el_prodTxt.style.display = 'none';
5243 }
5244
5245 // @ts-expect-error ST-2949_1
5246 var pack_label = product.pack_label || '',
5247 // @ts-expect-error ST-2949_1
5248 pack_m = parseInt(product.pack_m, 10) || 0,
5249 // @ts-expect-error ST-2949_1
5250 pack_x = parseInt(product.pack_x, 10) || 0,
5251 // @ts-expect-error ST-2949_1
5252 pack_y = parseInt(product.pack_y, 10) || 0,
5253 // @ts-expect-error ST-2949_1
5254 pack_z = parseInt(product.pack_z, 10) || 0,
5255 // @ts-expect-error ST-2949_1
5256 productUrl = product.url || '';
5257
5258 var isDimentions = pack_label && pack_x && pack_y && pack_z;
5259 var isWeight = pack_m;
5260 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)
5261 // @ts-expect-error ST-2949_1
5262 var isCharcs = (product.characteristics && product.characteristics.length > 0) || isDimentions || isWeight;
5263
5264 var isDescriptionDrawn = true;
5265 var isCharsDrawn = isCharcs;
5266
5267 // If any tab contains description or product characteristics, hide it in product overview
5268 var el_tabDescr = el_popup.querySelectorAll('.t-catalog__tabs .t-catalog__tabs__item[data-tab-type="text"]');
5269 if (el_tabDescr.length) {
5270 isDescriptionDrawn = false;
5271 }
5272
5273 var el_tabCharcs = el_popup.querySelectorAll('.t-catalog__tabs .t-catalog__tabs__item[data-tab-type="chars"]');
5274 if (el_tabCharcs.length) {
5275 isCharsDrawn = false;
5276 }
5277
5278 var prodTxt =
5279 '<div class="js-catalog-prod-all-text"' + (!isDescriptionDrawn ? ' style="display: none;"' : '') + '>';
5280 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)
5281 // @ts-expect-error ST-2949_1
5282 prodTxt += product.text || product.descr || '';
5283
5284 prodTxt += '</div>';
5285
5286 var charcsStyle = isDescriptionDrawn ? 'margin-top: 20px;' : '';
5287 charcsStyle += !isCharsDrawn ? 'display: none;' : '';
5288 var charcsTextWithDiv =
5289 '<div class="js-catalog-prod-all-charcs"' + (charcsStyle.length ? ' style="' + charcsStyle + '"' : '') + '>';
5290 var charcsTextOnly = '';
5291 if (isCharcs) {
5292 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)
5293 // @ts-expect-error ST-2949_1
5294 product.characteristics.forEach(function (ch) {
5295 charcsTextOnly +=
5296 '<p class="t-typography__characteristics js-catalog-prod-charcs">' +
5297 ch.title +
5298 ': ' +
5299 ch.value +
5300 '</p>';
Предыдущие 100 строкСледующие 100 строк