601const styleAttribute = button.getAttribute('style');602let borderRadius = 0;603let linkStyle = '';604let svgStyle = '';605let pathStyle = '';606if (styleAttribute) {607const btnStyleTag = styleAttribute.split(';');608609for (const style of btnStyleTag) {610if (!style.includes('border-radius')) continue;611612const currentBorderRadius = parseInt(style.match(/\d+/g)?.[0], 10);
if (!isNaN(currentBorderRadius)) borderRadius = currentBorderRadius; break; } } else { const compStyle = window.getComputedStyle(button); const parsedRadius = parseInt(compStyle.getPropertyValue('border-radius'), 10); if (!isNaN(parsedRadius)) borderRadius = parsedRadius; } if (borderRadius) { linkStyle += `border-radius:${borderRadius}px;`; } if (button.classList.contains('t-btn_xs') || button.classList.contains('t-btnflex_xs')) { linkStyle += 'width: 35px;height: 35px;'; svgStyle += 'width: 60%;height: 60%;'; pathStyle += 'stroke-width: 1px;'; } else if ((button.classList.contains('t-btn_sm') || button.classList.contains('t-btnflex_sm')) && borderRadius <= 15) { svgStyle += 'width: 55%;height: 55%;'; } else if (button.classList.contains('t-btn_md') || button.classList.contains('t-btnflex_md')) { linkStyle += 'width: 60px;height: 60px;'; svgStyle += 'width: 50%;height: 50%;'; } else if (button.classList.contains('t-btn_lg') || button.classList.contains('t-btnflex_lg')) { linkStyle += 'width: 60px;height: 60px;border: none;'; svgStyle += 'width: 50%;height: 50%;'; } else if (button.classList.contains('t-btn_xl') || button.classList.contains('t-btnflex_xl')) { linkStyle += 'width: 80px;height: 80px;border: none;'; svgStyle += 'width: 50%;height: 50%;'; } else if (button.classList.contains('t-btn_xxl') || button.classList.contains('t-btnflex_xxl')) { linkStyle += 'width: 100px;height: 100px;border: none;'; svgStyle += 'width: 50%;height: 50%;'; } button.style.marginRight = '0px'; return { link: linkStyle ? ' style="' + linkStyle + '"' : '', svg: svgStyle ? ' style="' + svgStyle + '"' : '', path: pathStyle ? ' style="' + pathStyle + '"' : '', };}/** * События виджета вишлиста и localStorage */function twishlist__addEvents() { var body = document.querySelector('body'); if (window.jQuery) { (function ($) { $('body').on('twishlist_addbtn', function () { twishlist__addProductButtons(); }); })(jQuery); } else { body.addEventListener('twishlist_addbtn', function () { twishlist__addProductButtons(); }); } var wishlistIcon = document.querySelector('.t1002__wishlisticon'); if (wishlistIcon) { wishlistIcon.addEventListener('click', function () { twishlist__openWishlist(); }); } body.addEventListener('click', function (e) { if (e.target && e.target.closest('a[href="#showfavorites"]')) { twishlist__openWishlist(); e.preventDefault(); } }); document.querySelector('.t1002__wishlistwin-close').addEventListener('click', function () { twishlist__closeWishlist(); }); document.querySelector('.t1002__wishlistwin').addEventListener('mousedown', function (e) { if (e.target == this) { var windowWidth = window.innerWidth; var maxScrollBarWidth = 17; var windowWithoutScrollBar = windowWidth - maxScrollBarWidth; if (e.clientX > windowWithoutScrollBar) { return; } twishlist__closeWishlist(); }