window.onload = () => { setTimeout(() => { // buy now button on item page let myEventfunction = () => { setTimeout(() => { const ItemLocation = window.location.href; let checkItemPage = ItemLocation.includes("/item"); if (checkItemPage) { const cx_1632983997891_product_details_quantity_content_wrap = document.querySelector(".sii001_cart_wrapper"); const buy_now_button_wrapper = elementMaker("div", ["buy_now_button_wrapper"]); const buy_now_button = elementMaker("button", ["buy_now_button", "sii001_cart_btn"]); buy_now_button.textContent = `Buy Now`; buy_now_button_wrapper.appendChild(buy_now_button); let childNodesLength = cx_1632983997891_product_details_quantity_content_wrap?.childNodes?.length; console.log("childNodesLength", childNodesLength); if (childNodesLength == 3) { cx_1632983997891_product_details_quantity_content_wrap.appendChild(buy_now_button_wrapper); } buy_now_button_wrapper.addEventListener("click", async function () { document.getElementById("sii001_add_to_cart_btn").click(); setTimeout(() => { typeof handleNavigate == "function" && handleNavigate("/cart"); }, 2000); }); } }, 1200); }; // link change watcher let previousHistory = ''; setInterval(() => { if (window.location.href !== previousHistory) { previousHistory = window.location.href; myEventfunction(); } }, 100); }, 1000); setTimeout(() => { // link change watcher let previousHistory = ''; setInterval(() => { if (window.location.href !== previousHistory) { previousHistory = window.location.href; myEventfunction(); } }, 100); // check out box myEventfunction = () => { setTimeout(() => { const checkoutLocation = window.location.href; let checkOutTrue = checkoutLocation.includes("/checkout"); if (checkOutTrue) { setTimeout(function () { // const _payment_info_g1g69_10 = document.getElementById("_payment_info_g1g69_10"); const _payment_info_g1g69_10 = document.querySelector("._payment_info_g1g69_10"); const checkBoxDiv = elementMaker("div", ["checkbox_container"]); const Custom_checkbox_main_wrapper = elementMaker("div", ["Custom_checkbox_main_wrapper"]); const checkbox_wrapper = elementMaker("div", ["checkbox_wrapper"]); Custom_checkbox_main_wrapper.appendChild(checkbox_wrapper); let checkBox_id = elementMaker("input", ["checkBox_id"], "checkBoxClick_id"); checkBox_id.setAttribute("type", "checkbox"); // checkBox_id.setAttribute("checked", true); checkbox_wrapper.appendChild(checkBox_id); const text_wrapper = elementMaker("div", ["text_wrapper"]); text_wrapper.innerHTML = `

you are accept our Term condition,Refund Policy and Privacy policy

`; Custom_checkbox_main_wrapper.appendChild(text_wrapper); checkBoxDiv.appendChild(Custom_checkbox_main_wrapper); let checkButtonAvaility = document.querySelector("._payment_info_g1g69_10").childNodes?.length; if (checkButtonAvaility == 4) { _payment_info_g1g69_10.append(checkBoxDiv); } const buttonDisableDiv = elementMaker("div", ["button_disable_wrapper"], "button_disable_id"); _payment_info_g1g69_10.appendChild(buttonDisableDiv); let answer = document.getElementById("checkBoxClick_id").hasAttribute("checked"); // console.log("answer", answer); if (answer == false) { buttonDisableDiv.style.display = `block`; } /* else { buttonDisableDiv.style.display = `none`; } */ checkBox_id.addEventListener("click", function () { if (document.getElementById("checkBoxClick_id").checked) { document.getElementById("checkBoxClick_id").setAttribute("checked", true); buttonDisableDiv.style.display = `none`; } else { document.getElementById("checkBoxClick_id").removeAttribute("checked", false); buttonDisableDiv.style.display = `block`; } }); }, 800); } }, 1000); }; }, 1400); function elementMaker(name, className, id) { try { let element = document.createElement(name); className && (element.className = className.join(" ")); id && (element.id = id); return element; } catch (err) { console.log(err.message); }; }; function setAttributes(elementName, allAttributes) { for (let key in allAttributes) { elementName.setAttribute(key, allAttributes[key]); }; }; }