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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-catalog-1.2.js

Код файла
Версия от 05.12.2026, 07:01:02 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
7501				: ''7502		);7503	}7504 7505	return str;7506}7507 7508/**7509 * Get URL for style="background-image: url()" of lazyload image7510 *7511 * @param {object} options7512 * @param {string} imgSrc - the original image URL7513
История файла и сравнение версий
  • 05.12.2026, 07:01:02 · 56c3b845
**/
7514function t_catalog_getLazyUrl(options, imgSrc) {
7515 // lazyLoad works just in published pages, so in redactor and previewmode we do not add smaller images
7516 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)
7517 // @ts-expect-error ST-2949_1
7518 if (!options.isPublishedPage || window.lazy !== 'y') {
7519 return imgSrc;
7520 }
7521 if (imgSrc.indexOf('static.tildacdn.' + t_catalog__getRootZone()) === -1) {
7522 // we can't apply lazy load to image, hosted to another servers
7523 return imgSrc;
7524 }
7525
7526 var arr = imgSrc.split('/');
7527 arr.splice(imgSrc.split('/').length - 1, 0, '-/resizeb/x20');
7528
7529 return arr.join('/');
7530}
7531
7532/**
7533 * Get URL for SRC attr of lazyload image
7534 *
7535 * @param options - an object with the following properties:
7536 * @param imgSrc - the original image URL
7537 **/
7538// TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)
7539// @ts-expect-error ST-2949_2
7540function t_catalog_getLazySrc(options, imgSrc) {
7541 // lazyLoad works just in published pages, so in redactor and previewmode we do not add smaller images
7542 if (!options.isPublishedPage || window.lazy !== 'y') {
7543 return imgSrc;
7544 }
7545 if (
7546 imgSrc.indexOf('.tildacdn.com') === -1 ||
7547 imgSrc.indexOf('-/empty/') !== -1 ||
7548 imgSrc.indexOf('-/resize/') !== -1
7549 ) {
7550 return imgSrc;
7551 }
7552
7553 var arr = imgSrc.split('/');
7554 arr.splice(imgSrc.split('/').length - 1, 0, '-/empty');
7555
7556 return arr.join('/');
7557}
7558
7559/**
7560 * Translated string based on the current language
7561 *
7562 * If the message is not empty and the dictionary exists and the message is in the dictionary, return
7563 * the message from the dictionary. Otherwise, return a message saying the text was not found.
7564 *
7565 * @param {string} msg - the text to translate
7566 * @returns {string} - translated text
7567 **/
7568
7569function t_catalog_dict(msg) {
7570 if (!window.tCatalogDict) {
7571 t_catalog__setGlobalDictObj();
7572 }
7573
7574 // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538)
7575 // @ts-expect-error ST-2949_3
7576 return window.tCatalogDict[msg] || 'Text not found for "' + msg + '"';
7577}
7578
7579/**
7580 * Escaping the quote character in the text
7581 *
7582 * @param {string} text
7583 * @returns {string} - text without quotes
7584 **/
7585function t_catalog_escapeQuote(text) {
7586 if (!text) {
7587 return '';
7588 }
7589 var map = {
7590 '"': '"',
7591 "'": ''',
7592 };
7593
7594 return text.replace(/["']/g, function (m) {
7595 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)
7596 // @ts-expect-error ST-2949_2
7597 return map[m];
7598 });
7599}
7600
Предыдущие 100 строкСледующие 100 строк