Некодим© 2020-2026 Некодим
Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.
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_29617 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);9625 * Given a color, return the lightness of that color to recolor the cross in the snippet9627 * @param {string} color - The color to convert to a lightness value9628 * @returns {number} The average of the red, green, and blue values9630 function 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;9637 * Remove the opacity value from the color string9639 * @param {string} color - the color to remove the opacity from.9640 * @returns {string} - the original color string with the opacity value removed.9642 function 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_59649 var result = color.split(',');9655 return result.join();9659 * Parsing the URL and extracting the query parameters9661 * @returns {object} JSON9663 function t_catalog_snippet_getJsonFromUrl() {9664 var url = window.location.search;9665 var query = url.substring(1);9668 query.split('&').forEach(function (part) {9669 var item = part.split('=');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_29673 result[item[0]] = decodeURIComponent(item[1]); /* TODO: item[1].replace(/%(?![0-9][0-9a-fA-F]+)/g, '%25') */9675 console.error(error);9676 // @ts-expect-error ST-2949_29677 result[item[0]] = item[1];9685 * Clean the price value9687 * @param {number|string} priceToClean9688 * @returns {number} clean price9691 * Remove the element from the DOM9693 * @param {HTMLElement} el - The element to remove9695 function t_catalog__removeElement(el) {9696 if (el && el.parentNode) {9697 el.parentNode.removeChild(el);