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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-catalog-1.1.js

Код файла
Версия от 04.12.2026, 04:03:55 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
4201			t_store_tabs_init(recid, options, product, el_product, el_popup, onPopupReady);4202		});4203	}4204}4205 4206/**4207 * Функция для применения аналогичных кнопке покупки эффектов к кнопке из блока ST6004208 *4209 * @param {HTMLElement} popup4210 **/4211function t_store_notifyButton_applyEffects(popup) {4212	var buyBtn = popup.querySelector('.t_catalog__prod-popup__btn-replaced');
История файла и сравнение версий
  • 04.12.2026, 04:03:55 · 56c3b845
4213 if (!buyBtn) return;
4214 var buyBtnEffects = buyBtn?.querySelector('.t-btn_wrap-effects') || buyBtn?.querySelector('.t-btn-effects');
4215 if (!buyBtnEffects) return;
4216 var notifyBtn = buyBtn.nextElementSibling;
4217 var notifyBtnEffects =
4218 notifyBtn?.querySelector('.t-btn_wrap-effects') || notifyBtn?.querySelector('.t-btn-effects');
4219 if (!notifyBtnEffects) {
4220 notifyBtn.appendChild(buyBtnEffects.cloneNode(true));
4221 }
4222}
4223
4224/**
4225 * This function is used to display the product text and characteristics in the product popup.
4226 *
4227 * @param {HTMLElement} el_popup - the popup element
4228 * @param {object} product - options of product
4229 **/
4230function t_store_initTextAndCharacteristics(el_popup, product) {
4231 var isSnippet =
4232 document.getElementById('allrecords') !== document.querySelector('.t-store__product-snippet') &&
4233 document.getElementById('allrecords').contains(document.querySelector('.t-store__product-snippet'));
4234 var el_prodTxt = el_popup.querySelector('.js-store-prod-text');
4235 if (el_prodTxt) {
4236 while (el_prodTxt.firstChild) {
4237 el_prodTxt.removeChild(el_prodTxt.firstChild);
4238 }
4239 el_prodTxt.style.display = 'none';
4240 }
4241
4242 var pack_label = product.pack_label || '',
4243 pack_m = parseInt(product.pack_m, 10) || 0,
4244 pack_x = parseInt(product.pack_x, 10) || 0,
4245 pack_y = parseInt(product.pack_y, 10) || 0,
4246 pack_z = parseInt(product.pack_z, 10) || 0,
4247 productUrl = product.url || '';
4248
4249 var isDimentions = pack_label && pack_x && pack_y && pack_z;
4250 var isWeight = pack_m;
4251 var isCharcs = (product.characteristics && product.characteristics.length > 0) || isDimentions || isWeight;
4252
4253 var isDescriptionDrawn = true;
4254 var isCharsDrawn = isCharcs;
4255
4256 // If any tab contains description or product characteristics, hide it in product overview
4257 var el_tabDescr = el_popup.querySelectorAll('.t-store__tabs .t-store__tabs__item[data-tab-type="text"]');
4258 if (el_tabDescr.length) {
4259 isDescriptionDrawn = false;
4260 }
4261
4262 var el_tabCharcs = el_popup.querySelectorAll('.t-store__tabs .t-store__tabs__item[data-tab-type="chars"]');
4263 if (el_tabCharcs.length) {
4264 isCharsDrawn = false;
4265 }
4266
4267 var prodTxt = '<div class="js-store-prod-all-text"' + (!isDescriptionDrawn ? ' style="display: none;"' : '') + '>';
4268 prodTxt += product.text || product.descr || '';
4269
4270 prodTxt += '</div>';
4271
4272 var charcsStyle = isDescriptionDrawn ? 'margin-top: 20px;' : '';
4273 charcsStyle += !isCharsDrawn ? 'display: none;' : '';
4274 var charcsTextWithDiv =
4275 '<div class="js-store-prod-all-charcs"' + (charcsStyle.length ? ' style="' + charcsStyle + '"' : '') + '>';
4276 var charcsTextOnly = '';
4277 if (isCharcs) {
4278 product.characteristics.forEach(function (ch) {
4279 charcsTextOnly +=
4280 '<p class="t-typography__characteristics js-store-prod-charcs">' + ch.title + ': ' + ch.value + '</p>';
4281 });
4282 }
4283
4284 // draw characteristics
4285 // add 'dimensions' & 'weight' always
4286 charcsTextOnly += '<p class="js-store-prod-dimensions t-typography__characteristics"></p>';
4287 charcsTextOnly += '<p class="js-store-prod-weight t-typography__characteristics"></p>';
4288 charcsTextWithDiv += charcsTextOnly;
4289 charcsTextWithDiv += '</div>';
4290 if (el_prodTxt) {
4291 el_prodTxt.insertAdjacentHTML('beforeend', prodTxt);
4292 el_prodTxt.insertAdjacentHTML('beforeend', charcsTextWithDiv);
4293 el_prodTxt.style.display = '';
4294 }
4295
4296 // Redraw dimensions and weight if corresponding tab exists in snippet
4297 if (isSnippet && el_tabCharcs.length) {
4298 Array.prototype.forEach.call(el_tabCharcs, function (item, i) {
4299 var el_charcsContent = item.querySelector('.t-store__tabs__content');
4300 if (el_charcsContent) {
Предыдущие 100 строкСледующие 100 строк