//common customized function and typing animation window.onload = () => { setTimeout(function () { const liquid_search_input_lg = document.getElementById("cx_1630815321671_search_input_lg"); const cx_1630815321671_search_input_md_sm = document.getElementById("cx_1630815321671_search_input_md_sm"); liquid_search_input_lg?.removeAttribute("placeholder"); cx_1630815321671_search_input_md_sm?.removeAttribute("placeholder"); timeout_var = null; function typeWriter(selector_target, text_list, placeholder = false, i = 0, text_list_i = 0, delay_ms = 110) { if (!i) { if (placeholder) { document.querySelector(selector_target).placeholder = ""; } else { document.querySelector(selector_target).innerHTML = ""; } }; txt = text_list[text_list_i]; if (i < txt.length) { if (placeholder) { document.querySelector(selector_target).placeholder += txt.charAt(i); } else { document.querySelector(selector_target).innerHTML += txt.charAt(i); } i++; setTimeout(typeWriter, delay_ms, selector_target, text_list, placeholder, i, text_list_i); } else { text_list_i++; if (typeof text_list[text_list_i] === "undefined") { setTimeout(typeWriter, (delay_ms * 5), selector_target, text_list, placeholder); } else { i = 0; setTimeout(typeWriter, (delay_ms * 3), selector_target, text_list, placeholder, i, text_list_i); } } }; text_list = [ "Search By Products Name", "Example 1 : Power Bank", "Example 2 : Headphones ", "Example 3 : Neckband" ]; typeWriter("#cx_1630815321671_search_input_lg", text_list, true); typeWriter("#cx_1630815321671_search_input_md_sm", text_list, true); setTimeout(() => { // add HOME button in navbar const cx_1630815321671_header_nav = document.querySelector(".cx_1630815321671_header_nav"); const homeButtonWrapper = elementMaker("div", ["allProductMneuWrapper"], "homeButton_id"); cx_1630815321671_header_nav.appendChild(homeButtonWrapper); const homeButton = elementMaker("span", ["allProductMenu"]); homeButton.textContent = `Blog`; homeButtonWrapper.appendChild(homeButton); homeButtonWrapper.addEventListener("click", function () { typeof handleNavigate == "function" && handleNavigate("/blogs"); }); // add all products button in navbar // const cx_1630815321671_header_nav = document.querySelector(".cx_1630815321671_header_nav"); const allProductMneuWrapper = elementMaker("div", ["allProductMneuWrapper"]); cx_1630815321671_header_nav.appendChild(allProductMneuWrapper); const allProductMenu = elementMaker("span", ["allProductMenu", "cx_1630815321671_main_nav_link"],"Shop_button_id"); allProductMenu.textContent = `Shop`; allProductMneuWrapper.appendChild(allProductMenu); allProductMneuWrapper.addEventListener("click", function () { typeof handleNavigate == "function" && handleNavigate("/items"); }); }, 500); 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]); }; }; }, 1350); } window.onload = () => { setTimeout(() => { let myEventfunction = () => { setTimeout(() => { const ItemLocation = window.location.href; let checkoutPage = ItemLocation.includes("/checkout"); if (checkoutPage) { const _choose_address__buttons_f0umj_18 = document.querySelector("._choose_address__buttons_f0umj_18"); _choose_address__buttons_f0umj_18.children[0].classList.add("_active_f0umj_38"); _choose_address__buttons_f0umj_18.children[0].click(); const content__text = document.querySelector(".content__text"); content__text.innerText = `অর্ডার করতে নিচের ফর্মটি পূরণ করুন `; } }, 1200); }; // link change watcher let previousHistory = ''; setInterval(() => { if (window.location.href !== previousHistory) { previousHistory = window.location.href; myEventfunction(); } }, 100); }, 1000); 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]); }; }; }