Каталог файловtilda-cart-1.1.js
1401 productObj['single'] = single;1402 }1403 1404 var quantityBtns = cartBtn.parentElement.querySelector('.t-catalog__prod__quantity, .t-store__prod__quantity');1405 if (quantityBtns) {1406 var input = quantityBtns.querySelector('.t-catalog__prod__quantity-input, .t-store__prod__quantity-input');1407 var count = parseInt(input.value, 10);1408 if (!isNaN(count) && count > 0) {1409 productObj['quantity'] = count;1410 // устанавливает количество по умолчанию1411 input.value = 1;
История файла и сравнение версий
t_triggerEvent(input, 'change');
1416 tcart__addProduct(productObj); 1418 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) 1419 // @ts-expect-error ST-2949_1 1420 if (window.tcart_sendevent_onadd == 'y') { 1422 // TODO ST-2949_4: cannot find name / missing jQuery types (TS2304, TS2592) 1423 // @ts-expect-error ST-2949_4 1424 Tilda.sendEcommerceEvent('add', [productObj]); 1426 // @ts-expect-error ST-2949_4 1427 if (window.Tilda && typeof Tilda.sendEventToStatistics == 'function') { 1428 var virtPage = '/tilda/cart/add/'; 1429 // TODO ST-2949_6: operators / arithmetic / unintentional comparison (TS2362, TS2365, TS2367) 1430 // @ts-expect-error ST-2949_6 1431 if (recid > 0) virtPage += recid; 1432 // @ts-expect-error ST-2949_6 1433 if (uid && uid > 0) { 1434 virtPage += '-u' + uid; 1435 // @ts-expect-error ST-2949_6 1436 } else if (lid && lid > 0) { 1437 virtPage += '-' + lid; 1439 var virtTitle = name; 1440 var virtPrice = productPrice; 1441 // TODO ST-2949_4: cannot find name / missing jQuery types (TS2304, TS2592) 1442 // @ts-expect-error ST-2949_4 1443 Tilda.sendEventToStatistics(virtPage, virtTitle, window.location.href, virtPrice); 1449 Array.prototype.forEach.call(recs, function (rec) { 1450 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) 1451 // @ts-expect-error ST-2949_2 1452 rec.addEventListener('click', function (event) { 1457 if (document.querySelectorAll('[data-record-type="396"]').length > 0) { 1458 // если на странице есть zero-блоки, то пробуем дождаться портала 1459 // Создаем observer для отслеживания добавления t396__tooltip-portal в dom 1460 const tooltipObserver = new MutationObserver((mutations, observer) => { 1461 mutations.forEach(mutation => { 1462 mutation.addedNodes.forEach(node => { 1463 if (node.nodeType === 1) { 1465 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) 1466 // @ts-expect-error ST-2949_1 1467 if (node.classList && node.classList.contains('t396__tooltip-portal')) { 1468 node.addEventListener('click', function (event) { 1471 // Самоуничтожаем observer после первого обнаружения 1472 observer.disconnect(); 1479 // Запускаем наблюдение за изменениями в body 1480 tooltipObserver.observe(document.body, { 1486 if (window.jQuery) { 1488 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) 1489 // @ts-expect-error ST-2949_2 1490 $('.r').on('click', '[href^="#order"]', function (event) { 1491 if (event.isTrigger === 3) { 1492 // programmatically click 1496 // TODO ST-2949_4: cannot find name / missing jQuery types (TS2304, TS2592) 1497 // @ts-expect-error ST-2949_4