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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-catalog-1.2.js

Код файла
Версия от 05.12.2026, 07:01:02 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
5001					true5002				);5003			} else {5004				t_catalog_closePopup(true, recid, opts);5005			}5006		} else {5007			t_catalog_closePopup(true, recid, opts);5008		}5009	};5010}5011 5012/**5013
История файла и сравнение версий
  • 05.12.2026, 07:01:02 · 56c3b845
* Enables lazy loading of images in a product popup when the user scrolls the popup.
5014 *
5015 * @param {string} recid - The ID of the product whose popup to enable lazy loading in.
5016 */
5017function t_catalog_popup_updLazyOnScroll(recid) {
5018 // need to update lazy on scroll in popup
5019 var scrollContainer = document.querySelector('#rec' + recid + ' .t-popup');
5020 const isPublishedMode = t_catalog__isPublishedMode();
5021 if (scrollContainer && isPublishedMode) {
5022 t_onFuncLoad('t_throttle', function () {
5023 // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538)
5024 // @ts-expect-error ST-2949_3
5025 scrollContainer.addEventListener(
5026 'scroll',
5027 t_throttle(function () {
5028 t_catalog_onFuncLoad('t_lazyload_update', function () {
5029 // TODO ST-2949_4: cannot find name / missing jQuery types (TS2304, TS2592)
5030 // @ts-expect-error ST-2949_4
5031 t_lazyload_update();
5032 });
5033 })
5034 );
5035 });
5036 }
5037}
5038
5039/**
5040 * Updates the URL and browser history to reflect the currently open product popup.
5041 *
5042 * @param {string} recid - The ID of the product whose popup is open.
5043 * @param {Object} product - An object containing data for the product whose popup is open.
5044 * @param {boolean} isRelevantsShow - Whether the product popup is showing relevant products.
5045 * @param {CatalogOptions} options - An object containing options for the product popup.
5046 */
5047function t_catalog_changeUrl(recid, product, isRelevantsShow, options) {
5048 var isiOS = /iPhone|iPad|iPod/i.test(navigator.userAgent);
5049 var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
5050 var curUrl = window.location.href;
5051 var productState = t_catalog__createProductHistoryState(product, options, isRelevantsShow, recid);
5052 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)
5053 // @ts-expect-error ST-2949_1
5054 var newPageTitle = document.title + ' – ' + product.title;
5055 var hasProductPattern = !!t_catalog__findBlockProductPatternInUrl(curUrl);
5056 var shouldSyncCanonical = isiOS && isSafari;
5057
5058 if (!hasProductPattern) {
5059 // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046)
5060 // @ts-expect-error ST-2949_5
5061 var newUrl = t_catalog_generateUrl(product);
5062 t_catalog__applyHistoryState(productState, newPageTitle, newUrl, {
5063 syncCanonical: shouldSyncCanonical,
5064 updateDocumentTitle: shouldSyncCanonical,
5065 });
5066 } else {
5067 if (!window.history.state || !window.history.state.productData) {
5068 t_catalog__applyHistoryState(productState, document.title, curUrl, { replace: true });
5069 }
5070
5071 if (isRelevantsShow) {
5072 // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046)
5073 // @ts-expect-error ST-2949_5
5074 var relevantsUrl = t_catalog_generateUrl(product);
5075 t_catalog__applyHistoryState(productState, newPageTitle, relevantsUrl, {
5076 syncCanonical: false,
5077 updateDocumentTitle: false,
5078 });
5079 }
5080 }
5081}
5082
5083/**
5084 * Generates a URL for the given product based on its relative path.
5085 *
5086 * @param {Object} product - An object containing data for the product to generate a URL for.
5087 * @param {string} product.url - The URL of the product.
5088 * @return {string} - The generated URL for the product.
5089 */
5090function t_catalog_generateUrl(product) {
5091 var currentProtocol = window.location.protocol;
5092 var currentHost = window.location.host;
5093 var relativeProductPath;
5094
5095 relativeProductPath = product.url.split('://')[1];
5096 relativeProductPath = relativeProductPath.split('/');
5097 relativeProductPath.shift();
5098 relativeProductPath = relativeProductPath.join('/');
5099
5100 return currentProtocol + '//' + currentHost + '/' + relativeProductPath;
Предыдущие 100 строкСледующие 100 строк