Каталог файловtilda-zoom-2.0.js
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
История файла и сравнение версий
const g = parseInt(hexMatch[2], 16);
1813 const b = parseInt(hexMatch[3], 16); 1814 return [r, g, b, 1]; 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]; 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]; 1836 return DEFAULT_RGBA; 1840 * get first color from gradient and transform from RGBA to RGB 1842 * @param {string} gradient - gradient 1843 * @returns {Array} - color in RGB format 1845function t_zoom_getFirstColorFromGradient(gradient) { 1846 const DEFAULT_RGB = [255, 255, 255]; 1848 if (!gradient || typeof gradient !== 'string') return DEFAULT_RGB; 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; 1854 let type, components; 1855 if (match[2] && match[3] && match[4] && match[5]) { 1857 components = [match[3], match[4], match[5]]; 1858 } else if (match[6] && match[7] && match[8] && match[9]) { 1860 components = [match[7], match[8], match[9]]; 1865 // Парсинг глобального стиля цвета 1866 const cssVarName = match[1]; 1868 const bodyStyle = window.getComputedStyle(document.body); 1869 const varValue = bodyStyle.getPropertyValue(cssVarName); 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); 1875 components = rgbMatch.splice(1); 1879 components = hexMatch.splice(1); 1885 return components.map(comp => parseInt(comp, type === '#' ? 16 : 10)); 1888function t_zoom__isScaled(modal) { 1889 if (window.visualViewport) { 1890 return window.visualViewport.scale !== 1 || modal.classList.contains('scale-active'); 1892 return modal.classList.contains('scale-active');