PageSourceSearch

https://santic.com/cdn/shop/t/101/assets/custom.js?v=80222536854385299851786358056

js santic.com collected 2026-09-24 09:49:29 UTC 11,679 bytes, 2 lines download raw bytes

1$(document).ready(function(){const freeProductEnabled2=window.free_product_enabled===!0&&Number(window.amount_free_product)>0;function formatPrice(originPrice,newPriceValue,isCount){let priceValue=isCount?newPriceValue.toString():(newPriceValue/100).toFixed(2).toString();originPrice.includes(",")&&(priceValue=priceValue.replace(".",","));const originPriceNumber=originPrice.replace(/[^0-9.,]/g,"");return originPrice.replace(originPriceNumber.toString(),priceValue)}function updateCartPriceAndCount(cart){const cartDrawerContainer=document.querySelector("cart-drawer");if(cartDrawerContainer){const totalsElem=cartDrawerContainer.querySelector(".gb-discounts-cart-values .totals__total"),itemsCountElem=cartDrawerContainer.querySelector(".gb-cart-total-item"),totalPriceElem=cartDrawerContainer.querySelector(".gb-discounts-cart-values .totals__total-value"),comparePriceElem=cartDrawerContainer.querySelector(".gb-discounts-cart-values .cart-item__old-price"),itemCount=cart.item_count,totalPrice=cart.total_price,originPriceText=totalPriceElem?.innerText??"",oldTotalPrice=originPriceText.replace(/[^0-9]/g,""),oldComparePriceText=comparePriceElem?.innerText??"";if(totalPriceElem&&(totalPriceElem.innerText=formatPrice(originPriceText,totalPrice)),itemsCountElem&&(itemsCountElem.innerText=formatPrice(itemsCountElem.innerText,itemCount,!0)),totalsElem&&(totalsElem.innerText=formatPrice(totalsElem.innerText,itemCount,!0)),comparePriceElem&&oldComparePriceText){const oldComparePrice=oldComparePriceText.replace(/[^0-9]/g,"");comparePriceElem.innerText=formatPrice(oldComparePriceText,parseInt(oldComparePrice)+parseInt(totalPrice)-parseInt(oldTotalPrice))}}}freeProductEnabled2&&(setTimeout(function(){var cart_total=$(".gb-totals-total-value").first().text();console.log("Initial cart total check:",cart_total,"threshold:",amount_free_product),cart_total>=amount_free_product?$(".cart-item").hasClass("gb-find-remove-product")?console.log("Free product already in cart"):(console.log("Adding free product"),$(".gb-free-product-tirgger").trigger("click")):(console.log("Removing free product - under threshold"),$(".gb-remove-product").trigger("click"))},3e3),$("body").on("click",".gb-sumbit-free",function(){setTimeout(function(){var cart_total=$(".gb-totals-total-value").first().text();cart_total>=amount_free_product?$(".cart-item").hasClass("gb-find-remove-product")||$(".gb-free-product-tirgger").trigger("click"):$(".gb-remove-product").trigger("click")},3e3)})),$("body").on("click",".quantity__button",function(){freeProductEnabled2&&setTimeout(function(){var cart_total=$(".gb-totals-total-value").first().text();cart_total>=amount_free_product?$(".cart-item").hasClass("gb-find-remove-product")||$(".gb-free-product-tirgger").trigger("click"):$(".gb-remove-product").trigger("click")},3e3)}),$("body").on("keyup",".quantity__input",function(){freeProductEnabled2&&setTimeout(function(){var cart_total=$(".gb-totals-total-value").first().text();cart_total>=amount_free_product?$(".cart-item").hasClass("gb-find-remove-product")||$(".gb-free-product-tirgger").trigger("click"):$(".gb-remove-product").trigger("click")},3e3)}),$("body").on("click",".cart-remove-button",function(){freeProductEnabled2&&setTimeout(function(){var cart_total=$(".gb-totals-total-value").first().text();cart_total>=amount_free_product?$(".cart-item").hasClass("gb-find-remove-product")||$(".gb-free-product-tirgger").trigger("click"):$(".gb-remove-product").trigger("click")},3e3)}),$("body").on("click",".gb-shipping-protection-button label.switch",async e=>{if(e.target.tagName=="INPUT")return;const curElem=document.querySelector(".gb-shipping-protection-button label.switch"),curInputElem=document.querySelector(".gb-shipping-protection-button label.switch input"),spinAnim=document.querySelector(".gb-shipping-protection-button .spin-animation"),checkElem=document.querySelector(".gb-shipping-protection-button .complete-check");if(curElem.classList.contains("unchecked")&&!curInputElem.checked){if(spinAnim.style.display=="block"||curInputElem.checked)return;const form=document.querySelector("form.shipping-protection-form"),formData=new FormData(form);spinAnim.style.display="block";try{(await fetch("/cart/add",{method:"POST",body:formData,headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}})).ok&&(spinAnim.style.display="none",checkElem.style.display="block",fetch("/cart.js").then(res=>res.json()).then(cart=>{updateCartPriceAndCount(cart)}))}catch(err){console.error("error at shipping protection form submission",err)}curElem.classList.remove("unchecked"),curElem.classList.add("checked"),curIn
1putElem.checked=!0}else if(curElem.classList.contains("checked")&&curInputElem.checked){checkElem.style.display="none";try{const protectItem=(await(await fetch("/cart.js")).json()).items.find(_item=>_item.id==shipping_product&&_item.discounts.length==0);if(protectItem){const response=await fetch("/cart/update",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({updates:{[protectItem.key]:0}})});if(response.ok){const cart=await response.json();updateCartPriceAndCount(cart)}}}catch(err){console.error("Error while removing shipping protection item",err)}curElem.classList.remove("checked"),curElem.classList.add("unchecked"),curInputElem.removeAttribute("checked")}}),$("body").on("change",".gb-change-variant_id",function(){var id_change=$(this).find(":selected").attr("data-variant-id");if(console.log("Variant changed to ID:",id_change),!id_change){console.error("No data-variant-id found on selected option");return}$(this).closest(".gb-get-main-freq-pro").find(".product-variant-id").val(id_change)})}),document.addEventListener("change",function(e){if(e.target.matches(".cart-drawer .gbfrequently-bought-with-main-whole .select__select")){const parentBlock=e.target.closest(".gb-get-main-freq-pro");if(!parentBlock){console.log("Error: Could not find parent block");return}const allValues=Array.from(parentBlock.querySelectorAll(".select__select")).map(sel=>sel.value).join(" / "),variantSelect=parentBlock.querySelector('[name="variants"]');if(!variantSelect){console.log("Error: Could not find variant selector");return}const matchedOption=Array.from(variantSelect.options).find(option=>option.text.includes(allValues)),idInput=parentBlock.querySelector('[name="id"]');if(!idInput){console.log("Error: Could not find id input field");return}matchedOption?(console.log("Matched variant option value:",matchedOption.value),idInput.value=matchedOption.value,console.log("Set ID input value to:",idInput.value)):console.log("No matching variant found for:",allValues)}}),document.addEventListener("submit",function(e){if(e.target.action&&e.target.action.includes("/cart/add")){const idInput=e.target.querySelector('[name="id"]');if(!idInput||!idInput.value)return console.log("Preventing submission - missing id parameter"),e.preventDefault(),!1}}),$(document).ready(function(){$("#QuantitySelector-template--16566428696689__main-7356969582705").on("change",".quantity__input",function(){console.log("Product page quantity changed to:",$(this).val());const quantityValue=$(this).val(),formElement=$("#"+"product-form-template--16566428696689__main");let quantityInput=formElement.find('input[name="quantity"]');quantityInput.length===0&&(console.log("Adding quantity input to form"),quantityInput=$("<input>").attr({type:"hidden",name:"quantity"}).appendTo(formElement)),quantityInput.val(quantityValue),console.log("Updated form quantity to:",quantityValue)}),$("#QuantitySelector-template--16566428696689__main-7356969582705 .quantity__input").on("input",function(){$(this).trigger("change")}),$("#product-form-template--16566428696689__main").on("submit",function(e){const idInput=$(this).find('input[name="id"]'),quantityInput=$(this).find('input[name="quantity"]');if(console.log("Product form submission - ID:",idInput.val(),"Quantity:",quantityInput.val()),!idInput.val())return console.error("Missing product ID in form submission"),e.preventDefault(),!1;(!quantityInput.val()||quantityInput.val()<1)&&(console.log("Setting default quantity to 1"),quantityInput.val(1))})}),$(document).ready(function(){$(".cart-item .quantity__button, .cart-item .quantity__input").on("click change input",function(){const cartItem=$(this).closest(".cart-item"),variantId=$(this).closest(".quantity-input").find(".quantity__input").data("quantity-variant-id");if($(this).closest("form").length>0){let idInput=$(this).closest("form").find('input[name="id"]');idInput.length===0&&variantId?(console.log("Adding missing ID input to cart form"),$("<input>").attr({type:"hidden",name:"id",value:variantId}).appendTo($(this).closest("form"))):idInput.length>0&&variantId&&idInput.val(variantId)}}),$("#CartDrawer-Checkout").on("click",function(e){const form=$("#CartDrawer-Form");if(form.length===0)return;const cartItems=form.find(".cart-item");if(cartItems.length===0)return console.log("No items in cart, preventing checkout"),e.preventDefault(),!1;console.log("Cart checkout with",cartItems.length,"items")});function checkFreeProductEligibility(){if(freeProductEnabled){var cart_total=$(".gb-totals-total-value").first().text();try{cart_total>=amount_free_product?$(".cart-item").hasClass("gb-find-remove-product")||$(".gb-free-product-tirgger").trigger("click"):$(".gb-remove-product").trigger("click")}catch(error){console.error("Error in free product handling:",error)}}}$(document).on("keydown",".quantity__input",function(e){(e.key==="Enter"||e.keyCode===13)&&(e.preventDefault(),$(this).trigger("blur"))}),$(".quantity__button, .quantity__input, .cart-remove-button").on("click change keyup",function(){clearTimeout($(this).data("freeProductTimer")),$(this).data("freeProductTimer",setTimeout(checkFreeProductEligibility,3e3))})}),$(document).ready(function(){$(".gbfrequently-bought-with-main-whole button, .gbfrequently-bought-with-main-whole .gb-sumbit-free, .gb-free-product-tirgger, .gb-product-shipping-protection-
1product-tirgger").on("click",function(e){const parentBlock=$(this).closest(".gb-get-main-freq-pro, form");if(!parentBlock){console.error("Could not find parent block for frequently bought product");return}let productId=null;const idInput=parentBlock.find('input[name="id"]');if(idInput.length>0&&idInput.val())productId=idInput.val();else if(parentBlock.find(".gb-change-variant_id").length>0){const selectedOption=parentBlock.find(".gb-change-variant_id option:selected");selectedOption.length>0&&(productId=selectedOption.data("variant-id"))}else parentBlock.find(".product-variant-id").length>0?productId=parentBlock.find(".product-variant-id").val():$(this).data("variant-id")&&(productId=$(this).data("variant-id"));if(console.log("Frequently bought product add to cart - ID:",productId),!productId)return console.error("Missing product ID for frequently bought product"),e.preventDefault(),!1;idInput.length===0?(console.log("Adding missing ID input to frequently bought product form"),$("<input>").attr({type:"hidden",name:"id",value:productId}).appendTo(parentBlock)):idInput.val(productId);let quantityInput=parentBlock.find('input[name="quantity"]');quantityInput.length===0?(console.log("Adding default quantity input to frequently bought product form"),$("<input>").attr({type:"hidden",name:"quantity",value:1}).appendTo(parentBlock)):(!quantityInput.val()||quantityInput.val()<1)&&quantityInput.val(1),console.log("Ready to add frequently bought product - ID:",productId,"Quantity:",parentBlock.find('input[name="quantity"]').val())})});
2//# sourceMappingURL=/cdn/shop/t/101/assets/custom.js.map?v=80222536854385299851786358056

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.