1window.displayOrderStatusCheck = false; 2 3function pushVolumeDiscountGATag(jsonData) { 4 if (jsonData) { 5 window.dataLayer = window.dataLayer || []; 6 window.dataLayer.push(jsonData); 7 } 8} 9 10document.addEventListener('DOMContentLoaded', function () { 11 addEventListener("message", (event) => { 12 if (event?.data && event?.data?.length > 0) { 13 try { 14 var obj = JSON.parse(event.data); 15 if (obj && obj?.name === "PushVolumeDiscountGATag") { 16 if (obj?.data?.event_category != '' && obj?.data?.event_action != '') { 17 let jsonData = { 18 event: "custom_event", 19 event_category: event_category, 20 event_action: event_action, 21 event_label: window.location.href, 22 product_id: product_id 23 }; 24 pushVolumeDiscountGATag(jsonData); 25 } 26 } 27 else if (obj && obj?.name === "BuyerGuide") { 28 window.location.href = obj?.data?.event_action; 29 } 30 else if (obj && obj?.name === "CHECK_ORDER_DIV") { 31 let exists = false; 32 let checkOrderBlock = $("#divCheckOrderBlock").children($('iframe'))[0]; 33 if (checkOrderBlock) { 34 exists = !!checkOrderBlock.contentDocument?.getElementById('divCheckOrder'); 35 } 36 event.source.postMessage({ 37 name: "CHECK_ORDER_DIV_RESULT", 38 data: { exists } 39 }, "*"); 40 41 } 42 else if (obj && obj?.name === "CHECK_ORDER_CLICK") { 43 if (obj?.data?.orderId) { 44 let jsonData = { 45 event: "custom_event", 46 event_category: "contact_page", 47 event_action: "check_order_status", 48 event_label: window.location.href, 49 data: obj?.data 50 51 }; 52 pushVolumeDiscountGATag(jsonData); 53 } 54 } 55 else if (obj && obj?.name === "OrderStatusCheck") { 56 const divCheckOrderBlock = document.getElementById('divCheckOrderBlock'); 57 if (!divCheckOrderBlock) return; 58 59 divCheckOrderBlock.classList.remove('highlight'); 60 void divCheckOrderBlock.offsetWidth; 61 divCheckOrderBlock.classList.add('highlight'); 62 63 const iframe = divCheckOrderBlock.querySelector('iframe'); 64 if (!iframe) return; 65 66 const focusInput = () => { 67 try { 68 const iframeDoc = iframe.contentWindow.document; 69 const orderInput = iframeDoc.getElementById('OrderId'); 70 if (orderInput) { 71 orderInput.classList.remove('highlight'); 72 void orderInput.offsetWidth; 73 orderInput.classList.add('highlight'); 74 orderInput.focus(); 75 } 76 } catch (e) { 77 console.log('Unable to access iframe content:', e); 78 } 79 }; 80 81 // If already loaded, focus immediately; otherwise wait for load 82 if (iframe.contentWindow && iframe.contentWindow.document?.readyState === 'complete') { 83 focusInput(); 84 } else { 85 iframe.removeEventListener('load', focusInput); 86 iframe.addEventListener('load', focusInput, { once: true });
87 } 88 89 } 90 } catch (e) { 91 console.log(e); 92 } 93 } 94 }); 95});
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.