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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-catalog-1.2.js

Код файла
Версия от 05.12.2026, 07:01:02 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
9601		return components;9602	}9603 9604	return null;9605}9606 9607/**9608 * Given a color, return the color that would be most visible against a background9609 *9610 * @param {Array<*>|string} color - the color to convert9611 * @returns {string} 'black' or 'white'9612 **/
История файла и сравнение версий
  • 05.12.2026, 07:01:02 · 56c3b845
9613
function t_catalog_luma_rgb(color) {
9614 const DEFAULT_COLOR = 'black';
9615 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)
9616 // @ts-expect-error ST-2949_2
9617 const checkColor = colorArray =>
9618 0.2126 * colorArray[0] + 0.7152 * colorArray[1] + 0.0722 * colorArray[2] > 128 ? 'black' : 'white';
9619 const parsedColor = t_catalog_parsecolor(color);
9620 if (!parsedColor) return DEFAULT_COLOR;
9621 return checkColor(parsedColor);
9622}
9623
9624/**
9625 * Given a color, return the lightness of that color to recolor the cross in the snippet
9626 *
9627 * @param {string} color - The color to convert to a lightness value
9628 * @returns {number} The average of the red, green, and blue values
9629 **/
9630function t_catalog_getLightnessColor(color) {
9631 const parsedColor = t_catalog_parsecolor(color) || [0, 0, 0];
9632 const normalizedColor = parsedColor.map(comp => comp / 255);
9633 return (Math.max(...normalizedColor) + Math.min(...normalizedColor)) / 2;
9634}
9635
9636/**
9637 * Remove the opacity value from the color string
9638 *
9639 * @param {string} color - the color to remove the opacity from.
9640 * @returns {string} - the original color string with the opacity value removed.
9641 **/
9642function t_catalog_removeRgbOpacity(color) {
9643 if (!color || !color.length) {
9644 // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046)
9645 // @ts-expect-error ST-2949_5
9646 return null;
9647 }
9648
9649 var result = color.split(',');
9650
9651 if (result[3]) {
9652 result[3] = '1)';
9653 }
9654
9655 return result.join();
9656}
9657
9658/**
9659 * Parsing the URL and extracting the query parameters
9660 *
9661 * @returns {object} JSON
9662 **/
9663function t_catalog_snippet_getJsonFromUrl() {
9664 var url = window.location.search;
9665 var query = url.substring(1);
9666 var result = {};
9667
9668 query.split('&').forEach(function (part) {
9669 var item = part.split('=');
9670 try {
9671 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)
9672 // @ts-expect-error ST-2949_2
9673 result[item[0]] = decodeURIComponent(item[1]); /* TODO: item[1].replace(/%(?![0-9][0-9a-fA-F]+)/g, '%25') */
9674 } catch (error) {
9675 console.error(error);
9676 // @ts-expect-error ST-2949_2
9677 result[item[0]] = item[1];
9678 }
9679 });
9680
9681 return result;
9682}
9683
9684/**
9685 * Clean the price value
9686 *
9687 * @param {number|string} priceToClean
9688 * @returns {number} clean price
9689 **/
9690/**
9691 * Remove the element from the DOM
9692 *
9693 * @param {HTMLElement} el - The element to remove
9694 **/
9695function t_catalog__removeElement(el) {
9696 if (el && el.parentNode) {
9697 el.parentNode.removeChild(el);
9698 }
9699}
9700
Предыдущие 100 строкСледующие 100 строк