(function() { var take = function() { window.AqurBaseURL = 'https://pr.aqur.com'; window.addEventListener("chatform_initialized", async (event) => { const urlParams = new URLSearchParams(window.location.search); const u = urlParams.get("u") || ""; if (u.includes("980") && !u.includes("1980")) { var param={ type: "chatform_shareParams", btnClass:"cdhsbtn980" } const target = document.querySelector('.chatform_widget'); target.contentWindow.postMessage(param, "*"); } const btn = document.querySelector('.chatformBtn'); if (btn && btn.innerText.trim() === "起動ボタン") { btn.remove(); } setTimeout(() => { const links = document.querySelectorAll( 'a[href="#chatform"], a[href="#chatformBtn"], a[href="chatformBtn"]' ); links.forEach((link) => { link.removeAttribute("href"); link.style.cursor = "pointer"; link.classList.add("chatformBtn"); console.log("Removed href and added chatformBtn class."); }); setTimeout(() => { // 親のボタンコンテナを取得 const buttonContainers = document.querySelectorAll('.fixed_btn.anim-box.fuwafuwa'); buttonContainers.forEach((container) => { // .cdhsbtn980 にクリックイベント追加 const divButton = container.querySelector('.cdhsbtn980'); if (divButton) { divButton.style.cursor = "pointer"; divButton.addEventListener("click", () => { activateChatformWidget(); }); } // 画像にもクリックイベント追加(念のため) const imgButton = container.querySelector('img'); if (imgButton) { imgButton.style.cursor = "pointer"; imgButton.addEventListener("click", () => { activateChatformWidget(); }); } }); }, 300); }, 300); setTimeout(() => { if (localStorage.getItem("chatform") && document.querySelector("#alert-box") !== null) { console.log("hide work") ScrollFormtoSubmit() }else{ console.log("no hide work") } }, 500); createAqurBinding() }); function render(template, data) { return template.replace(/{{(.*?)}}/g, (match) => { return data[match.split(/{{|}}/).filter(Boolean)[0].trim()] }) } function activateChatformWidget() { if (!chatform_initialized) { console.log("Aqur is not ready") return } const w = document.querySelector('.chatform_widget'); w.classList.toggle("close"); if (w.classList.contains("close")) { document.body.classList.remove("chat_open"); } else { document.body.classList.add("chat_open"); } } var chatform_initialized = false const pid = "cdhs"; const target = "production"; const mode = "release"; const device = JSON.parse("false".toLowerCase()) ? "mobile" : "pc"; var launch = "click"; const client = "https://form.aqur.com"; let REF = new URL(window.location); let userChatbot = REF.searchParams.get('usechatbot') if (userChatbot == "no") { console.log("no chatbot") return } REF.searchParams.append('pid', pid); REF.searchParams.append('mode', mode); REF.searchParams.append('target', target); REF.searchParams.append('hash', "859d2c1f-d89f-4305-920c-3aef4737e548"); REF.searchParams.append('browser', "undefined"); REF.searchParams.append('device', device); REF.searchParams.append('os', "undefined"); REF.searchParams.append('ua', "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)"); REF.searchParams.append('ip', "216.73.216.228"); REF.searchParams.append('ref', REF.href); REF.searchParams.append('path', REF.pathname); //for UI REF.searchParams.append('CLIENT_ID', 'PR'); REF.searchParams.append('BASE_URL', 'https://pr.aqur.com'); REF.searchParams.append('HEADER_LABEL', ' '); REF.searchParams.append('HEADER_BG_COLOR', '#fff'); REF.searchParams.append('HEADER_LABEL_COLOR', '#fff'); REF.searchParams.append('SHOW_TIMER', 'false'); REF.searchParams.append('ICON_PATH', 'https://res.cloudinary.com/dts6mbw86/image/upload/v1713319985/aqur/common/icon_azvikf.png'); const params = new URLSearchParams(REF.search.slice(1)); let search = REF.search.slice(1) //console.log(search) launch = params.get('launch'); let widget = render( '' + '', { device: device, client: client, search: (search) ? "&" + search : "", } ); const body = document.body; if (body) { var filterid; const chatbotProgressBar = "
" body.insertAdjacentHTML('beforeend', chatbotProgressBar); body.classList.add(device) body.insertAdjacentHTML('beforeend', widget); const target = document.querySelector('.chatform_widget'); const observer = new MutationObserver((mutations) => { mutations.forEach((mutation) => { if (!target.classList.contains("close")) { var contentWindow = target.contentWindow; if (contentWindow) { contentWindow.postMessage("chat_open", "*"); contentWindow.postMessage( { type: "filterIdChanged", data: filterid }, "*"); } } }); }); const config = { characterData: true, attributes: true, subtree: true }; observer.observe(target, config); } let creationComplete = function () { if (device == "pc") { var resize = () => { let zoom_level = window.devicePixelRatio || window.screen.availWidth / document.documentElement.clientWidth * 100; const targets = document.querySelectorAll('body,.chatform_widget'); if (zoom_level >= 3) { targets[0].classList.add("mobile") targets[0].classList.remove("pc") targets[1].classList.add("mobile") targets[1].classList.remove("pc") } else { targets[0].classList.add("pc") targets[0].classList.remove("mobile") targets[1].classList.add("pc") targets[1].classList.remove("mobile") } } resize() window.addEventListener("resize", () => { resize() }) } document.addEventListener('click', (event) => { console.log("event.target =>", event.target) if (event.target && event.target.closest('.chatformBtn') || event.target.classList.contains("chatformBtn") || event.target.closest('.cdhsbtn980') || event.target.classList.contains("cdhsbtn980") || event.target.closest('.cdhsbtn1870') || event.target.classList.contains("cdhsbtn1870") || event.target.id == "chatform_widget_cancelbtn" ) { console.log("event", event) activateChatformWidget() } }); document.dispatchEvent(new CustomEvent("chatform_widget_creation_complete")); }; setTimeout(creationComplete, 250); window.addEventListener("message", async (event) => { if (event.data.event == "chatform_close") { activateChatformWidget(); } if (event.data.event == "chatform_evalScript") { window.eval(event.data.script) } if (event.data.event == "chatform_insertTag") { body.insertAdjacentHTML("beforeend", event.data.tag); event.data.scripts.forEach((item) => { eval(item.textContent) }) } if (event.data.event == "chatform_initialized") { console.log("Aqur Initialized") document.getElementById("chatbotProgressBar").style.width = "100%"; var opacity = function () { document.getElementById("chatbotProgressBar").style.opacity = "0"; }; setTimeout(opacity, 1000); chatform_initialized = true; if (launch == "auto") { activateChatformWidget(); } window.dispatchEvent(new CustomEvent("chatform_initialized")); } if (event.data.event == "chatform_sent") { //console.log("chatform_sent") var project = event.data.project; var arr = project.data; var chatform = { pid: project.pid, sid: project.sid, uuId: project.uuId, customId:"conversion" } localStorage.setItem('chatform', JSON.stringify(chatform)); bindandSubmit(arr) } if(window.aqur){ window.aqur.bind(event) } }, false) } setTimeout(take, 0); }()) function createAqurBinding() { console.log("AqurBindingCreated") //aqur bind start window.aqur = {} window.aqur.debug = false; // false -> to change, true for debug mode window.aqur.save = (key, value) => { window.aqur[key] = value; // You can access data anytime using window.aqur.XXX } window.aqur.bind = (event) => { // console.log("waq",event.data.event) if (event.data.event === "name") { const values = event.data.value?.values || []; const firstName = values[0]?.value || ""; const lastName = values[1]?.value || ""; const firstKana = values[2]?.value || ""; const lastKana = values[3]?.value || ""; const FullName = firstName + lastName; const FullNameKana = firstKana + lastKana; window.aqur.setFullName(FullName); window.aqur.setFullNameKana(FullNameKana); window.aqur.save("FullName", FullName); window.aqur.save("FullNameKana", FullNameKana); } if (event.data.event == "address") { var FullAddress = event.data.value.values[0].value + event.data.value.values[1].value + event.data.value.values[2].value + event.data.value.values[3].value + event.data.value.values[4].value; if(FullAddress!=window.aqur.FullAddress){ window.aqur.setPostalCode(event.data.value.values[0].value) window.aqur.setPref(event.data.value.values[1].value) window.aqur.setCity(event.data.value.values[2].value) window.aqur.setStreet(event.data.value.values[3].value) window.aqur.setBuilding(event.data.value.values[4].value) window.aqur.save("PostalCode", event.data.value.values[0].value) window.aqur.save("Pref", event.data.value.values[1].value) window.aqur.save("City", event.data.value.values[2].value) window.aqur.save("Street", event.data.value.values[3].value.replace(/[−ー―‐-〜]/g, '-')) window.aqur.save("Building", event.data.value.values[4].value.replace(/[−ー―‐-〜]/g, '-')) window.aqur.save("FullAddress", event.data.value.values[0].value + event.data.value.values[1].value + event.data.value.values[2].value + event.data.value.values[3].value + event.data.value.values[4].value ) } } if (event.data.event == "tel") { window.aqur.setTel(event.data.value.values[0].value) window.aqur.save("Tel", event.data.value.values[0].value) } if (event.data.event == "email") { window.aqur.setEmail(event.data.value.values[0].value) window.aqur.save("Email", event.data.value.values[0].value) } if (event.data.event == "gender") { var item = window.aqur.getCheckedOptionSA(event.data.value.options) if(item){ window.aqur.setGender(item.value) window.aqur.save("Gender", item.value) } } if (event.data.event == "birthday") { if(event.data.value.values[0].value && event.data.value.values[1].value && event.data.value.values[2].value){ window.aqur.setBirthdayYear(Number(event.data.value.values[0].value)) window.aqur.setBirthdayMonth(Number(event.data.value.values[1].value)) window.aqur.setBirthdayDay(Number(event.data.value.values[2].value)) window.aqur.save("Year", event.data.value.values[0].value) window.aqur.save("Month", event.data.value.values[1].value) window.aqur.save("Day", event.data.value.values[2].value) } } if (event.data.event == "SelOtherDeli") { var item = window.aqur.getCheckedOptionSA(event.data.value.options) if(item){ window.aqur.setSelOtherDeli(item.value) window.aqur.save("SelOtherDeli", item.value) } } if (event.data.event == "otherDeli") { var FullAddress = event.data.value.values[0].value + event.data.value.values[1].value + event.data.value.values[2].value + event.data.value.values[3].value + event.data.value.values[4].value; if(FullAddress!=window.aqur.OtherFullAddress){ window.aqur.setOtherPostalCode(event.data.value.values[0].value) window.aqur.setOtherPref(event.data.value.values[1].value) window.aqur.setOtherCity(event.data.value.values[2].value) window.aqur.setOtherStreet(event.data.value.values[3].value) window.aqur.setOtherBuilding(event.data.value.values[4].value) window.aqur.save("OtherPostalCode", event.data.value.values[0].value) window.aqur.save("OtherPref", event.data.value.values[1].value) window.aqur.save("OtherCity", event.data.value.values[2].value) window.aqur.save("OtherStreet", event.data.value.values[3].value.replace(/[−ー―‐-〜]/g, '-')) window.aqur.save("OtherBuilding", event.data.value.values[4].value.replace(/[−ー―‐-〜]/g, '-')) window.aqur.save("OtherFullAddress", event.data.value.values[0].value + event.data.value.values[1].value + event.data.value.values[2].value + event.data.value.values[3].value + event.data.value.values[4].value ) } } // if (event.data.event == "password") { // window.aqur.setPassword(event.data.value.values[0].value) // window.aqur.save("Password", event.data.value.values[0].value) // if(window.aqur.City){ // window.aqur.setCity(window.aqur.City) // } // } if (event.data.event == "payment") { var item = window.aqur.getCheckedOptionSA(event.data.value.options) if (item) { window.aqur.setPaymentMethodTypeKey(item.value) window.aqur.save("Payment", item.value) } } if (event.data.event == "cc") { window.aqur.setCardNumber(event.data.value.values[0].value) window.aqur.setCardExpirationYear(event.data.value.values[1].value) window.aqur.setCardExpirationMonth(event.data.value.values[2].value) window.aqur.setCardCvc(event.data.value.values[3].value) window.aqur.setCardHolderName(event.data.value.values[4].value) window.aqur.save("CardNumber", event.data.value.values[0].value) window.aqur.save("CardExpirationYear", event.data.value.values[1].value) window.aqur.save("CardExpirationMonth", event.data.value.values[2].value) window.aqur.save("CardExpirationCvc", event.data.value.values[3].value) window.aqur.save("CardHolderName", event.data.value.values[4].value) } } //Binding Method for ECForce //お名前(姓) + (名) window.aqur.setFullName = (value) => { window.aqur.debug && console.log("debug setFullName", value); window.aqur.fillInput('input[name="order[billing_address_attributes][name01]"]', value) } //お名前(姓 kana) + (名 kana) window.aqur.setFullNameKana = (value) => { window.aqur.debug && console.log("debug setFullNameKana", value); window.aqur.fillInput('input[name="order[billing_address_attributes][kana01]"]', value) } window.aqur.setPostalCode = (value) => { window.aqur.debug && console.log("debug setPostalCode", value); window.aqur.fillInput('[name="order[billing_address_attributes][zip01]"]', value) function callLater() { window.aqur.setCity(window.aqur.City) window.aqur.setStreet(window.aqur.Street) window.aqur.setBuilding(window.aqur.Building) } setTimeout(callLater, 1000); } window.aqur.setPref = (value) => { window.aqur.debug && console.log("debug setPref", value); window.aqur.chooseSelectBoxLabel('select[name="order[billing_address_attributes][prefecture_id]"]', value) } window.aqur.setCity = (value) => { window.aqur.debug && console.log("debug setCity", value); window.aqur.fillInput('input[name="order[billing_address_attributes][addr01]"]', value) } window.aqur.setStreet = (value) => { window.aqur.debug && console.log("debug setStreet", value); if(!document.querySelector('input#order_billing_address_attributes_addr03')){ var concat = value +" "+window.aqur.Building window.aqur.fillInput('input#order_billing_address_attributes_addr02', concat) }else{ window.aqur.fillInput('input#order_billing_address_attributes_addr02', value) } } window.aqur.setBuilding = (value) => { window.aqur.debug && console.log("debug setBuilding", value); window.aqur.fillInput('input#order_billing_address_attributes_addr03', value) } window.aqur.setTel = (value) => { window.aqur.debug && console.log("debug setTel", value); window.aqur.fillInput('input[name="order[billing_address_attributes][tel01]"]', value.replace(/-/g,'')) } window.aqur.setEmail = (value) => { window.aqur.debug && console.log("debug setEmail", value); window.aqur.fillInput('input[name="order[email]"]', value) } window.aqur.setGender = (value) => { window.aqur.debug && console.log("debug setGender", value); const gender = document.querySelector('[name="sex"][value="'+value+'"]') if(gender){ gender.click() } } window.aqur.setBirthdayYear = (value) => { window.aqur.debug && console.log("debug setBirthdayYear", value); window.aqur.chooseSelectBox('select[name="order[customer_attributes][birth(1i)]"]', value) } window.aqur.setBirthdayMonth = (value) => { window.aqur.debug && console.log("debug setBirthdayMonth", value); window.aqur.chooseSelectBox('select[name="order[customer_attributes][birth(2i)]"]', value) } window.aqur.setBirthdayDay = (value) => { window.aqur.debug && console.log("debug setBirthdayDay", value); window.aqur.chooseSelectBox('select[name="order[customer_attributes][birth(3i)]"]', value) } window.aqur.setGender = (value) => { window.aqur.debug && console.log("debug setGender", value); window.aqur.chooseSelectBox('select[name="order[customer_attributes][sex_id]"]', value) } window.aqur.setSelOtherDeli = (value) => { window.aqur.debug && console.log("debug setSelOtherDeli", value); window.aqur.chooseSelectBox('select#shipping_address_id', value) } window.aqur.setOtherFullName = (value) => { window.aqur.debug && console.log("debug setOtherFullName", value); window.aqur.fillInput('input[name="order[shipping_address_attributes][name01]"]', value) } //お名前(姓 kana) + (名 kana) window.aqur.setOtherFullNameKana = (value) => { window.aqur.debug && console.log("debug setOtherFullNameKana", value); window.aqur.fillInput('input[name="order[shipping_address_attributes][kana01]"]', value) } window.aqur.setOtherTel = (value) => { window.aqur.debug && console.log("debug setOtherTel", value); window.aqur.fillInput('input[name="order[shipping_address_attributes][tel01]"]', value.replace(/-/g,'')) } window.aqur.setOtherPostalCode = (value) => { window.aqur.debug && console.log("debug setOtherPostalCode", value); window.aqur.fillInput('input[name="order[shipping_address_attributes][zip01]"]', value) //adjust the other input field if(value.length == 7 && window.aqur.FullName && window.aqur.Tel){ window.aqur.setOtherFullName(window.aqur.FullName) window.aqur.setOtherFullNameKana(window.aqur.FullNameKana) window.aqur.setOtherTel(window.aqur.Tel) } function callLater() { window.aqur.setOtherCity(window.aqur.OtherCity) window.aqur.setOtherStreet(window.aqur.OtherStreet) window.aqur.setOtherBuilding(window.aqur.OtherBuilding) } setTimeout(callLater, 1000); } window.aqur.setOtherPref = (value) => { window.aqur.debug && console.log("debug setOtherPref", value); window.aqur.chooseSelectBoxLabel('select#order_shipping_address_attributes_prefecture_name', value) } window.aqur.setOtherCity = (value) => { window.aqur.debug && console.log("debug setOtherCity", value); window.aqur.fillInput('input#order_shipping_address_attributes_addr01', value) } window.aqur.setOtherStreet = (value) => { window.aqur.debug && console.log("debug setOtherStreet", value); if (!document.querySelector('input#order_shipping_address_attributes_addr03')) { var concat = value + " " + window.aqur.OtherBuilding window.aqur.fillInput('input#order_shipping_address_attributes_addr02', concat) } else { window.aqur.fillInput('input#order_shipping_address_attributes_addr02', value) } } window.aqur.setOtherBuilding = (value) => { window.aqur.debug && console.log("debug setOtherBuilding", value); window.aqur.fillInput('input#order_shipping_address_attributes_addr03', value) } //パスワード // window.aqur.setPassword = (value) => { window.aqur.debug && console.log("debug setPassword", value); // window.aqur.fillInput('input[name="password"]', value) // window.aqur.fillInput('input[name="confirmPassword"]', value) // } //お支払い方法選択 window.aqur.setPaymentMethodTypeKey = (value) => { window.aqur.debug && console.log("debug setPaymentMethodTypeKey", value); window.aqur.chooseSelectBox('select[name="order[payment_attributes][payment_method_id]"]', value) } //クレジットカード番号 window.aqur.setCardNumber = (value) => { window.aqur.debug && console.log("debug setCardNumber", value); window.aqur.fillInput('input[name="order[payment_attributes][source_attributes][number]"]', value) } //クレジットカード名 window.aqur.setCardHolderName = (value) => { window.aqur.debug && console.log("debug setCardHolderName", value); window.aqur.fillInput('input[name="order[payment_attributes][source_attributes][name]"]', value) } //カードの有効期限(年) window.aqur.setCardExpirationYear = (value) => { window.aqur.debug && console.log("debug setCardExpirationYear", value); window.aqur.chooseSelectBox('select[name="order[payment_attributes][source_attributes][year]"]', value) } //カードの有効期限(月) window.aqur.setCardExpirationMonth = (value) => { const cleanedValue = parseInt(value, 10); if (window.aqur.debug) { console.log("debug setCardExpirationMonth", cleanedValue); } window.aqur.chooseSelectBox( 'select[name="order[payment_attributes][source_attributes][month]"]', cleanedValue ); }; window.aqur.setCardCvc = (value) => { window.aqur.debug && console.log("debug setCardCvc", value); window.aqur.fillInput('input[name="cvv"]', value) } //Helper Method window.aqur.convertToHalfWidth = (input) => { if(input){ return input.replace(/[0-9−ー―‐]/g, (match) => { if (/[0-9]/.test(match)) { // 全角数字を半角数字に変換 return String.fromCharCode(match.charCodeAt(0) - 0xFEE0); } else { return '-'; } }); }else{ return ''; } } window.aqur.getCheckedOptionSA = (options) => { var rtn = options.find((v) => v.checked) return rtn } window.aqur.getCheckedOptionMA = (options) => { var checkedOptions = options.filter((v) => v.checked); var rtn = checkedOptions.map((v) => v.value); return rtn.join(", "); } window.aqur.waitForElement = (selectors, timeout = 5000) => { return new Promise((resolve, reject) => { const interval = 100; let elapsedTime = 0; const checkExistence = () => { for (const selector of selectors) { const element = document.querySelector(selector); if (element) { resolve(element); return; } } elapsedTime += interval; if (elapsedTime >= timeout) { reject(new Error(`None of the elements with selectors "${selectors.join(', ')}" were found within the timeout`)); } else { setTimeout(checkExistence, interval); } }; checkExistence(); }); }; window.aqur.fillInput = (selector, value) => { const inputElement = document.querySelector(selector); if (inputElement) { let nativeValueSetter = Object.getOwnPropertyDescriptor( window.HTMLInputElement.prototype, "value" ).set; nativeValueSetter.call(inputElement, value); let inputEvent = new Event("input", { bubbles: true }); inputElement.dispatchEvent(inputEvent); } }; window.aqur.chooseSelectBox = (selectBoxSelector, value, useOptionVal = true) => { let option = "" if(useOptionVal) { option = document.querySelector(`${selectBoxSelector} option[value='${value}']`); } else { option = document.querySelector(`${selectBoxSelector} option[label='${value}']`); } const selectElement = document.querySelector(`${selectBoxSelector}`); if (option && selectElement) { option.selected = true; const event = new Event('change', { bubbles: true, composed: true }) selectElement.dispatchEvent(event); } }; window.aqur.chooseSelectVueBox = (selectBoxSelector, value, useOptionVal = true) => { const selectElement = document.querySelector(selectBoxSelector); if (!selectElement) return; let option; if (useOptionVal) { option = selectElement.querySelector(`option[value='${value}']`); } else { option = Array.from(selectElement.options).find(opt => opt.text.trim() === value); } if (option) { // Directly update the select element's value selectElement.value = option.value; // Manually trigger Vue's reactivity update using native property setter let nativeSetter = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, "value").set; nativeSetter.call(selectElement, option.value); // Dispatch both 'input' and 'change' events to notify Vue selectElement.dispatchEvent(new Event("input", { bubbles: true })); selectElement.dispatchEvent(new Event("change", { bubbles: true })); } }; window.aqur.chooseSelectBoxLabel = (selectBoxSelector, label) => { const selectElement = document.querySelector(selectBoxSelector); var option; if (selectElement) { option = Array.from(selectElement.options).find( opt => opt.textContent.trim() === label ); } if (option) { option.selected = true; const event = new Event('change', { bubbles: true, composed: true }); selectElement.dispatchEvent(event); // selectElement.focus() } }; //aqur bind finish } function bindandSubmit(data) { try { const agreementCheckbox = document.querySelector("input#agree"); if (agreementCheckbox && !agreementCheckbox.checked) { agreementCheckbox.click(); console.log("Agreement checkbox clicked."); } if( window.aqur.Payment && window.aqur.Payment == 20){ const amazonPayButton = document.getElementById("AmazonPayButton"); if (amazonPayButton !== null) { amazonPayButton.click(); } }else{ let submitButton = null; if (document.querySelector("input.submit_button_complete_ec")) { submitButton = document.querySelector("input.submit_button_complete_ec"); } else if (document.querySelector("input.submit_button_complete_sp_ec")) { submitButton = document.querySelector("input.submit_button_complete_sp_ec"); } else if (document.querySelector("input.submit_bottom_ec")) { submitButton = document.querySelector("input.submit_bottom_ec"); } else if (document.querySelector("input.submit_bottom_sp_ec")) { submitButton = document.querySelector("input.submit_bottom_sp_ec"); } if (!submitButton) { console.warn("No submit button found."); return; } submitButton.click(); setTimeout(() => { try { submitButton.click(); } catch (err) { console.error("Error during second click:", err); } }, 1000); } } catch (error) { console.error("Error in bindandSubmit:", error); } } function ChatFormWidgetHide() { console.log("ChatFormWidgetHide"); if (localStorage.getItem("chatform")) { // Trigger a general click (if needed) document.body.click(); const widget = document.querySelector('.chatform_widget'); if (!widget || !widget.contentWindow) { console.warn("Chat widget not available."); return; } const param = { event: "chatform_BeforeSubmit" }; widget.contentWindow.postMessage(param, "*"); widget.classList.toggle("close"); if (widget.classList.contains("close")) { document.body.classList.remove("chat_open"); } } } function ScrollFormtoSubmit() { const viewForm = document.querySelector('#order_billing_address_attributes_name1'); if (!viewForm) { console.warn("#order_billing_address_attributes_name1 not found on the page."); return; } const isAndroid = /Android/i.test(navigator.userAgent); if (isAndroid) { // Direct hash jump for Android window.location.hash = "#order_billing_address_attributes_name1"; const viewFormPosition = viewForm.getBoundingClientRect().top + window.pageYOffset - 100; window.scrollTo({ top: viewFormPosition, behavior: 'smooth' }); } else { // Smooth scroll for non-Android devices requestAnimationFrame(() => { viewForm.scrollIntoView({ behavior: 'smooth', block: 'start' }); }); } }