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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-catalog-1.1.js

Код файла
Версия от 04.12.2026, 04:03:55 МСК
Оригинал на CDNСнимок 56c3b845Полный текст

Это первая доступная в Git версия файла.

1/**2 * tilda-catalog работает во всех блоках категории ST (store), а также на отдельных страницах товаров, подключенных к каталогу3 **/4 5import { t_cart__useRootZone } from '../src/tilda-cart/shared/rootZone/index.ts';6import {7	t_catalog__addVideoIconForGallery,8	t_catalog__getVideoElement,9	t_catalog__svgVideoIcon,10} from '../src/tilda-catalog/gallery-video/index.ts';11 12
История файла и сравнение версий
  • 04.12.2026, 04:03:55 · 56c3b845
// global variables declaration
13window.tStoreIsSearchBot = /Bot/i.test(navigator.userAgent);
14window.tStoreIsMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
15window.tStoreBrowserLang = (window.navigator.userLanguage || window.navigator.language).toUpperCase().slice(0, 2);
16
17window.t_store_endpoint = 'store.tildaapi.com';
18
19const t_store_POPUP_SHOWED_EVENT_NAME = 'catalog:popupShowed';
20const t_store_POPUP_CLOSED_EVENT_NAME = 'catalog:popupClosed';
21
22/**
23 * Language override based on attribute
24 **/
25t_onReady(function () {
26 const allRecords = document.getElementById('allrecords');
27
28 if (allRecords) {
29 const projectLang = allRecords.getAttribute('data-tilda-project-lang');
30 if (projectLang) {
31 window.tStoreBrowserLang = projectLang;
32 }
33
34 t_store__setupEndpoint();
35 }
36
37 t_store_getDictObj();
38 t_store_fixImgs();
39});
40
41// Временный фикс для Safari 16.3: картинки с position: absolute непропорционально растягивались
42// object-fit: contain исправляет это поведение. Фикс надо удалить по истечению времени
43function t_store_fixImgs() {
44 var isSafari16_3 = /Version\/16\.3/.test(navigator.userAgent) && /Safari/.test(navigator.userAgent);
45 if (!isSafari16_3) return;
46
47 var recTypes = ['754', '776', '778', '786', '1025'];
48 recTypes.forEach(function (recType) {
49 var imgs = document.querySelectorAll(
50 `[data-record-type="${recType}"] .t-img, [data-parenttplid="${recType}"] .t-img`
51 );
52 Array.prototype.forEach.call(imgs, function (img) {
53 img.style.objectFit = 'contain';
54 });
55 });
56}
57
58/**
59 * This function is responsible for initializing the store
60 *
61 * @param {string} recid
62 * @param {TildaStoreOptions} options
63 **/
64
65function t_store_init(recid, options) {
66 t_onReady(function () {
67 var rec = document.getElementById('rec' + recid);
68 if (!rec) return;
69 if (!window.tStoreInit) {
70 window.tStoreInit = {};
71 }
72 window.tStoreInit[recid] = true;
73
74 const allRecords = document.getElementById('allrecords');
75
76 if (allRecords) {
77 t_store__setupEndpoint();
78 }
79
80 // apply lazy init, if block's count > 7th
81 if ('IntersectionObserver' in window && Object.keys(window.tStoreInit).length > 7) {
82 window.tStoreInit[recid] = 'lazy';
83 var recordObserver = new IntersectionObserver(
84 function (entries, observer) {
85 entries.forEach(function (entry) {
86 if (entry.isIntersecting) {
87 var target = entry.target;
88 observer.unobserve(target);
89 if (window.tStoreInit[recid] === 'lazy') {
90 t_store_lazyInit(recid, options);
91 window.tStoreInit[recid] = true;
92 }
93 }
94 });
95 },
96 {
97 rootMargin: '150px 0px',
98 }
99 );
100 recordObserver.observe(rec);
Следующие 100 строк