3001} else {3002cartIconText.style.display = 'none';3003}3004}30053006tcart__delZeroquantity_inCartObj();30073008document.removeEventListener('keyup', tcart__keyUpFunc);30093010if (cartIcon) cartIcon.classList.remove('t706__carticon_neworder');3011cartWindow.style.transition = 'opacity .3s';3012cartWindow.style.opacity = 0;
setTimeout(function () { cartWindow.classList.remove('t706__cartwin_showed'); cartWindow.style.opacity = '1'; }, 300); if (window.tcart_success == 'yes') { location.reload(); }}function tcart__getLostCart(params) { var apiUrl = 'https://forms.tildacdn.com/api/v1/getlostbasket/'; var xhr = new XMLHttpRequest(); xhr.open('POST', apiUrl); xhr.onload = function () { if (xhr.status >= 200 && xhr.status < 400) { var data = xhr.responseText; if (typeof data !== 'string' || data.substr(0, 1) !== '{') { console.error("Can't get array."); } try { var dataObj = JSON.parse(data); var productsArr = dataObj.jsonproducts; if (!productsArr || productsArr.length === 0) { tcart__addLostCartStyles(); tcart__showWrongOrderPopup(); tcart__clearLostCartUrl(); var msg = dataObj.error ? dataObj.error : "Something went wrong. Can't get products array."; console.error(msg); } else { tcart__getProductsInfoById(productsArr); } } catch (e) { console.error("Can't get JSON.", data); } } }; xhr.send(JSON.stringify(params));}function tcart__clearLostCartUrl() { var currentUrl = window.location.href; var indexToRemove = currentUrl.indexOf('#!/torder/'); if (indexToRemove > -1) { try { window.history.replaceState('', '', currentUrl.substring(0, indexToRemove)); } catch (e) {} }}function tcart__restoreLostCart(restoredProducts) { if (window.tcart['products'].length !== 0) { tcart__addLostCartStyles(); tcart__showClearCartDialog(); var dialog = document.querySelector('#clear-cart-dialog'); var saveItems = dialog.querySelector('.js-clearcart-no'); var cleartCart = dialog.querySelector('.js-clearcart-yes'); var closeDialog = function () { t_triggerEvent(document.body, 'popupHidden'); document.body.classList.remove('t-body_popupshowed'); if (dialog.parentNode !== null) { dialog.parentNode.removeChild(dialog); } }; saveItems.addEventListener('click', function () { closeDialog(); tcart__openRestoredCart(restoredProducts); }); cleartCart.addEventListener('click', function () { closeDialog(); window.tcart = { amount: 0, currency: '', system: '', products: [], }; if (typeof localStorage === 'object') { try { localStorage.removeItem('tcart'); } catch (e) {