1jQuery(document).ready(function ($) { 2 //get the count of products in the wish list 3 fetch('/wp-json/galante/v1/wishlist-count/') 4 .then(response => response.json()) 5 .then(data => { 6 if (data.success) { 7 jQuery('.bwp-header .header-page-link .wishlist-box .count-wishlist').text(data.count); 8 } 9 }); 10 11 function updateCartCount() { 12 $.ajax({ 13 url: '/?wc-ajax=get_cart_count', // WooCommerce AJAX URL 14 type: 'GET', 15 success: function (response) { 16 if (response.success) { 17 jQuery('.bwp-header .header-page-link .mini-cart .cart-icon .icons-cart .cart-count').text(response.count); 18 } 19 }, 20 error: function () { 21 console.log("Failed to fetch cart count."); 22 } 23 }); 24 } 25 26 // Call function on page load 27 //updateCartCount(); 28 29 const toggleContainer = (toggleButton, container) => { 30 toggleButton.addEventListener('click', function (e) { 31 e.preventDefault(); 32 if (container.style.display === 'none' || container.style.display === '') { 33 container.style.display = 'block'; 34 toggleButton.classList.add('active'); 35 } else { 36 container.style.display = 'none'; 37 toggleButton.classList.remove('active'); 38 } 39 }); 40 } 41 42 document.querySelectorAll('.show-wallets-toggle a span').forEach(button => { 43 document.querySelectorAll('.wallets-by-color').forEach(walletContainer => { 44 if (button && walletContainer) { 45 toggleContainer(button, walletContainer); 46 } 47 }); 48 }); 49 50 document.querySelectorAll('.show-female-wallets-toggle a span').forEach(button => { 51 document.querySelectorAll('.female-wallets-by-color').forEach(walletContainer => { 52 if (button && walletContainer) { 53 toggleContainer(button, walletContainer); 54 } 55 }); 56 }); 57 58 document.querySelectorAll('.show-tie-toggle a span').forEach(button => { 59 document.querySelectorAll('.tie-by-color').forEach(tieContainer => { 60 if (button && tieContainer) { 61 toggleContainer(button, tieContainer); 62 } 63 }); 64 }); 65 66 document.querySelectorAll('.show-watch-toggle').forEach(button => { 67 document.querySelectorAll('.watch-by-color').forEach(watchContainer => { 68 if (button && watchContainer) { 69 toggleContainer(button, watchContainer); 70 } 71 }); 72 }); 73 74 document.querySelectorAll('.bwp_product_list .item-product h1.product-title').forEach(tag => { 75 const newP = document.createElement('p'); 76 newP.innerHTML = tag.innerHTML; 77 newP.className = tag.className; 78 tag.parentNode.replaceChild(newP, tag); 79 }); 80 81 document.querySelectorAll('.category_baner_home h3, .category_baner_home_big h3').forEach(tag => { 82 const newP = document.createElement('p'); 83 newP.innerHTML = tag.innerHTML; 84 newP.className = tag.className; 85 tag.parentNode.replaceChild(newP, tag); 86 }); 87 88 const formCheckoutCoupon = document.querySelector('form.checkout_coupon'); 89 if (formCheckoutCoupon) { 90 const button = formCheckoutCoupon.querySelector('button[name="apply_coupon"]'); 91 button.addEventListener('click', function(e) { 92 const errors = document.querySelector('form.checkout_coupon').querySelectorAll('span.coupon-error-notice'); 93 94 if (errors) { 95 errors.forEach(error => { 96 error.remove(); 97 }); 98 } 99 }); 100 } 101 102 const neededInvoice = document.querySelector('.checkout #billing_invoice_needed'); 103 if (neededInvoice) { 104 neededInvoice.addEventListener('click', function () { 105 const companyDataContainer = document.querySelector('#billing-invoice-data'); 106 if (this.checked) { 107 companyDataContainer.style.display = 'block'; 108 } else { 109 companyDataContainer.style.display = 'none'; 110 } 111 }); 112 } 113 114 var $form = $('form.variations_form'); 115 116 if (!$form.length) return; 117 118 var variations = $form.data('product_variations'); 119 if (!variations || !variations.length) return; 120 121 variations.forEach(function (v) { 122 if (v.is_in_stock === false && v.is_purchasable === true) { 123 Object.entries(v.attributes || {}
123).forEach(function ([attrName, value]) { 124 if (!value) return; 125 126 var selector = 127 '.tawcvs-swatches[data-attribute_name="' + attrName + '"] ' + 128 '.swatch[data-value="' + value + '"]'; 129 130 $(selector).addClass('custom-out-of-stock'); 131 }); 132 } 133 }); 134});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.