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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-wishlist-1.0.js

Код файла
Версия от 04.12.2026, 04:03:54 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
601	const styleAttribute = button.getAttribute('style');602	let borderRadius = 0;603	let linkStyle = '';604	let svgStyle = '';605	let pathStyle = '';606	if (styleAttribute) {607		const btnStyleTag = styleAttribute.split(';');608 609		for (const style of btnStyleTag) {610			if (!style.includes('border-radius')) continue;611 612			const currentBorderRadius = parseInt(style.match(/\d+/g)?.[0], 10);
История файла и сравнение версий
  • 04.12.2026, 04:03:54 · 56c3b845
613 if (!isNaN(currentBorderRadius)) borderRadius = currentBorderRadius;
614 break;
615 }
616 } else {
617 const compStyle = window.getComputedStyle(button);
618 const parsedRadius = parseInt(compStyle.getPropertyValue('border-radius'), 10);
619 if (!isNaN(parsedRadius)) borderRadius = parsedRadius;
620 }
621
622 if (borderRadius) {
623 linkStyle += `border-radius:${borderRadius}px;`;
624 }
625
626 if (button.classList.contains('t-btn_xs') || button.classList.contains('t-btnflex_xs')) {
627 linkStyle += 'width: 35px;height: 35px;';
628 svgStyle += 'width: 60%;height: 60%;';
629 pathStyle += 'stroke-width: 1px;';
630 } else if ((button.classList.contains('t-btn_sm') || button.classList.contains('t-btnflex_sm')) && borderRadius <= 15) {
631 svgStyle += 'width: 55%;height: 55%;';
632 } else if (button.classList.contains('t-btn_md') || button.classList.contains('t-btnflex_md')) {
633 linkStyle += 'width: 60px;height: 60px;';
634 svgStyle += 'width: 50%;height: 50%;';
635 } else if (button.classList.contains('t-btn_lg') || button.classList.contains('t-btnflex_lg')) {
636 linkStyle += 'width: 60px;height: 60px;border: none;';
637 svgStyle += 'width: 50%;height: 50%;';
638 } else if (button.classList.contains('t-btn_xl') || button.classList.contains('t-btnflex_xl')) {
639 linkStyle += 'width: 80px;height: 80px;border: none;';
640 svgStyle += 'width: 50%;height: 50%;';
641 } else if (button.classList.contains('t-btn_xxl') || button.classList.contains('t-btnflex_xxl')) {
642 linkStyle += 'width: 100px;height: 100px;border: none;';
643 svgStyle += 'width: 50%;height: 50%;';
644 }
645
646 button.style.marginRight = '0px';
647
648 return {
649 link: linkStyle ? ' style="' + linkStyle + '"' : '',
650 svg: svgStyle ? ' style="' + svgStyle + '"' : '',
651 path: pathStyle ? ' style="' + pathStyle + '"' : '',
652 };
653}
654
655/**
656 * События виджета вишлиста и localStorage
657 */
658function twishlist__addEvents() {
659 var body = document.querySelector('body');
660
661 if (window.jQuery) {
662 (function ($) {
663 $('body').on('twishlist_addbtn', function () {
664 twishlist__addProductButtons();
665 });
666 })(jQuery);
667 } else {
668 body.addEventListener('twishlist_addbtn', function () {
669 twishlist__addProductButtons();
670 });
671 }
672
673 var wishlistIcon = document.querySelector('.t1002__wishlisticon');
674 if (wishlistIcon) {
675 wishlistIcon.addEventListener('click', function () {
676 twishlist__openWishlist();
677 });
678 }
679
680 body.addEventListener('click', function (e) {
681 if (e.target && e.target.closest('a[href="#showfavorites"]')) {
682 twishlist__openWishlist();
683 e.preventDefault();
684 }
685 });
686
687 document.querySelector('.t1002__wishlistwin-close').addEventListener('click', function () {
688 twishlist__closeWishlist();
689 });
690
691 document.querySelector('.t1002__wishlistwin').addEventListener('mousedown', function (e) {
692 if (e.target == this) {
693 var windowWidth = window.innerWidth;
694 var maxScrollBarWidth = 17;
695 var windowWithoutScrollBar = windowWidth - maxScrollBarWidth;
696 if (e.clientX > windowWithoutScrollBar) {
697 return;
698 }
699 twishlist__closeWishlist();
700 }
Предыдущие 100 строкСледующие 100 строк