Некодим© 2020-2026 Некодим
Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.
Журнал изменений История Git Файлы Tilda MCP Каталог файловtilda-cart-1.0.js Следить за файлом 1001 }1002 1003 // Декодируем название, так как HTML кодирует кириллицу в href1004 // Не трогаем весь payload до split('='), чтобы %3D в имени не ломал цену1005 if (name) name = t_cart__safeDecodeURIComponent(name).trim();1006 1007 // обрабатывает параметры1008 if (typeof imgLink !== 'undefined' && imgLink !== '') {1009 if (imgLink.indexOf('=') > 0) {1010 var imgLinkArr = imgLink.split('=');1011 if (imgLinkArr[0] && imgLinkArr[1]) {1012 История файла и сравнение версий if (imgLinkArr[0] == 'image' && imgLinkArr[1].indexOf('.tildacdn.') > 0) {
1013 img = imgLinkArr[1];1020 recid = cartBtn.closest('.r').getAttribute('id')1021 ? cartBtn.closest('.r').getAttribute('id').replace('rec', '')1027 var productElement = cartBtn.closest('.js-product');1028 if (productElement) {1030 var elementName = productElement.querySelector('.js-product-name');1031 name = elementName ? elementName.textContent.trim() : '';1033 if (price == '' || price == 0) {1034 var elementPrice = productElement.querySelector('.js-product-price');1036 if (elementPrice.classList.contains('js-store-prod-price-range-val')) {1037 price = elementPrice.getAttribute('data-product-price-range-val');1039 price = elementPrice.textContent;1042 price = tcart__cleanPrice(price);1045 if (productElement.getAttribute('data-product-img')) {1046 img = productElement.getAttribute('data-product-img');1048 var imgDiv = productElement.querySelector('.js-product-img');1050 var original = imgDiv.getAttribute('data-original') || '';1051 if (original.length > 0) {1053 } else if (imgDiv.tagName == 'IMG') {1054 img = imgDiv.getAttribute('src');1055 } else if (imgDiv.tagName == 'DIV') {1057 var imgCss = getComputedStyle(imgDiv)['background-image'];1059 img = imgCss.replace('url(', '').replace(')', '').replace(/"/gi, '');1066 lid = productElement.getAttribute('data-product-lid') || '';1069 uid = productElement.getAttribute('data-product-uid') || '';1072 var recidAttr = productElement.closest('.r').getAttribute('id');1073 recid = recidAttr ? recidAttr.replace('rec', '') : '';1077 inv = productElement.getAttribute('data-product-inv') || '';1080 unit = productElement.getAttribute('data-product-unit') || '';1081 portion = productElement.getAttribute('data-product-portion') || '';1082 single = productElement.getAttribute('data-product-single') || '';1084 // варианты товара (с разными свойствами)1085 var editionOptionsElements = productElement.querySelectorAll('.js-product-edition-option');1086 Array.prototype.forEach.call(editionOptionsElements, function (optionsElement) {1087 var optionName = optionsElement.querySelector('.js-product-edition-option-name').textContent;1088 var selectedOption = optionsElement.querySelector('option:checked');1089 if (selectedOption) {1090 var optionVariant = selectedOption.value;1091 var optionPrice = selectedOption.getAttribute('data-product-edition-variant-price');1092 optionPrice = tcart__cleanPrice(optionPrice);1094 if (optionName && optionVariant) {1096 if (optionName != '') {1097 optionName = tcart__escapeHtml(optionName);1099 if (optionVariant != '') {1100 optionVariant = tcart__escapeHtml(optionVariant);