<style>
.blkElem{pointer-events:none; }
.cartcopyanim {
-webkit-animation: t706__pulse-anim 0.6s;
animation: t706__pulse-anim 0.6s;}
.cartcopy_elem .tn-atom , .cartprice_elem .tn-atom {display:none}
.cartcopy{cursor:pointer}
.t706__carticon {display: none !important;}
</style>
<script>
document.addEventListener('DOMContentLoaded', function() {
let hideMode = false; // Скрыть-Показать пустую корзину - true-false
document.querySelectorAll('.cartcopy_elem .tn-atom').forEach(function(element) {
element.classList.add('cartcopy');
});
document.querySelectorAll('.cartprice_elem .tn-atom').forEach(function(element) {
element.classList.add('cartcopyprice');
});
function chkNum() {
if (!hideMode) {
document.querySelectorAll('.cartcopy, .cartcopyprice').forEach(function(element) {
element.style.display = 'block';
});
}
let chCounter = window.tcart.total;
let chPrice = window.tcart.prodamount;
if (chPrice === 0) {
document.querySelector('div[data-elem-type="text"] .cartcopyprice').innerHTML = '';
if (hideMode) {
document.querySelectorAll('.cartcopy, .cartcopyprice').forEach(function(element) {
element.style.display = 'none';
});
} else {
document.querySelectorAll('.cartcopy, .cartcopyprice').forEach(function(element) {
element.style.display = 'block';
});
}
} else {
document.querySelector('div[data-elem-type="text"] .cartcopyprice').innerHTML = chPrice + ' руб';
if (hideMode) {
document.querySelectorAll('.cartcopy, .cartcopyprice').forEach(function(element) {
element.style.display = 'block';
});
}
}
document.querySelector('div[data-elem-type="text"] .cartcopy').innerHTML = chCounter;
if (chCounter === 0) {
document.querySelector('.cartcopy').classList.add('blkElem');
} else {
document.querySelector('.cartcopy').classList.remove('blkElem');
}
if (chCounter === '') {
document.querySelector('div[data-elem-type="text"] .cartcopy').innerHTML = 0;
}
}
setTimeout(function() {
chkNum();
}, 500);
document.querySelector(".t706").addEventListener('DOMSubtreeModified', function(event) {
if (event.target.classList.contains('t706__carticon-counter')) {
setTimeout(function() {
chkNum();
}, 300);
document.querySelector('div[data-elem-type="image"] .cartcopy').classList.add('cartcopyanim');
setTimeout(function() {
document.querySelector('.cartcopy').classList.remove('cartcopyanim');
}, 1000);
}
});
document.querySelector('.cartcopy').addEventListener('click', function(event) {
event.preventDefault();
tcart__openCart();
});
});
</script>