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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-zoom-2.0.js

Код файла
Версия от 04.12.2026, 04:03:54 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
1801		const r = parseInt(hexAlphaMatch[1], 16);1802		const g = parseInt(hexAlphaMatch[2], 16);1803		const b = parseInt(hexAlphaMatch[3], 16);1804		const a = parseInt(hexAlphaMatch[4], 16) / 255;1805		return [r, g, b, a];1806	}1807 1808	// Парсинг #RRGGBB формата (6 символов)1809	const hexMatch = /^#?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i.exec(colorString);1810	if (hexMatch) {1811		const r = parseInt(hexMatch[1], 16);1812
История файла и сравнение версий
  • 04.12.2026, 04:03:54 · 56c3b845
const g = parseInt(hexMatch[2], 16);
1813 const b = parseInt(hexMatch[3], 16);
1814 return [r, g, b, 1];
1815 }
1816
1817 // Парсинг #RGB формата (3 символа)
1818 const hexShortMatch = /^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i.exec(colorString);
1819 if (hexShortMatch) {
1820 const r = parseInt(hexShortMatch[1] + hexShortMatch[1], 16);
1821 const g = parseInt(hexShortMatch[2] + hexShortMatch[2], 16);
1822 const b = parseInt(hexShortMatch[3] + hexShortMatch[3], 16);
1823 return [r, g, b, 1];
1824 }
1825
1826 // Парсинг #RGBA формата (4 символа)
1827 const hexShortAlphaMatch = /^#?([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])$/i.exec(colorString);
1828 if (hexShortAlphaMatch) {
1829 const r = parseInt(hexShortAlphaMatch[1] + hexShortAlphaMatch[1], 16);
1830 const g = parseInt(hexShortAlphaMatch[2] + hexShortAlphaMatch[2], 16);
1831 const b = parseInt(hexShortAlphaMatch[3] + hexShortAlphaMatch[3], 16);
1832 const a = parseInt(hexShortAlphaMatch[4] + hexShortAlphaMatch[4], 16) / 255;
1833 return [r, g, b, a];
1834 }
1835
1836 return DEFAULT_RGBA;
1837}
1838
1839/**
1840 * get first color from gradient and transform from RGBA to RGB
1841 *
1842 * @param {string} gradient - gradient
1843 * @returns {Array} - color in RGB format
1844 */
1845function t_zoom_getFirstColorFromGradient(gradient) {
1846 const DEFAULT_RGB = [255, 255, 255];
1847
1848 if (!gradient || typeof gradient !== 'string') return DEFAULT_RGB;
1849 const regexp =
1850 /(?:var\((--uc-color-color-[a-zA-Z0-9]+),)?(?:(rgb)a?\(([0-9]+),([0-9]+),([0-9]+)(?:,[0-9.%]+)?\))|(?:(#)([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2}))/;
1851 const match = regexp.exec(gradient);
1852 if (!match) return DEFAULT_RGB;
1853
1854 let type, components;
1855 if (match[2] && match[3] && match[4] && match[5]) {
1856 type = match[2];
1857 components = [match[3], match[4], match[5]];
1858 } else if (match[6] && match[7] && match[8] && match[9]) {
1859 type = match[6];
1860 components = [match[7], match[8], match[9]];
1861 } else {
1862 return DEFAULT_RGB;
1863 }
1864
1865 // Парсинг глобального стиля цвета
1866 const cssVarName = match[1];
1867 if (cssVarName) {
1868 const bodyStyle = window.getComputedStyle(document.body);
1869 const varValue = bodyStyle.getPropertyValue(cssVarName);
1870 if (varValue) {
1871 const rgbMatch = /^rgba?\(([0-9]+),\s*([0-9]+),\s*([0-9]+)(?:,\s*[0-9.%]+)?\)$/i.exec(varValue);
1872 const hexMatch = /^#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/i.exec(varValue);
1873
1874 if (rgbMatch) {
1875 components = rgbMatch.splice(1);
1876 type = 'rgb';
1877 }
1878 if (hexMatch) {
1879 components = hexMatch.splice(1);
1880 type = '#';
1881 }
1882 }
1883 }
1884
1885 return components.map(comp => parseInt(comp, type === '#' ? 16 : 10));
1886}
1887
1888function t_zoom__isScaled(modal) {
1889 if (window.visualViewport) {
1890 return window.visualViewport.scale !== 1 || modal.classList.contains('scale-active');
1891 } else {
1892 return modal.classList.contains('scale-active');
1893 }
1894}
Предыдущие 100 строк