1async function sendBluecoreSignupEventOptIn(email, codeJSON = "") { 2 const url = getBrandName() === 'GALLS' ? 'https://api.bluecore.com/email/send/v1/galls' : 'https://api.bluecore.com/email/send/v1/us_patriot'; 3 const campaignId = getBrandName() === 'GALLS' ? '6005919351955456' : '4905575943364608' 4 let couponCode = null; 5 6 try { 7 const data = JSON.parse(codeJSON); 8 const key = Object.keys(data)[0]; 9 if (key !== 'E') { 10 couponCode = key; 11 } 12 } catch (e) {} 13 14 // console.log("BLUEC COUPON CODE:", couponCode ?? ""); 15 try { 16 const formData = new URLSearchParams(); 17 formData.append("SIURL", url); 18 formData.append("SITYPE", "POST"); 19 formData.append("SIDATA", JSON.stringify({ 20 "campaign_id": campaignId, 21 "email": email, 22 "use_draft": true, 23 "template_attributes": { 24 "coupon_code": couponCode ?? "", 25 } 26 })); 27 28 const response = await fetch('/cgbcbluec', { 29 method: 'POST', 30 body: formData, 31 }); 32 33 if (!response.ok) { 34 throw new Error(`HTTP error! Status: ${response.status} ${response.statusText}`); 35 } 36 37 const responseData = await response.json(); 38 // console.log("BLUEC SUCCESS:", responseData); 39 } catch (error) { 40 // console.error("BLUEC ERROR:", error); 41 } 42} 43 44// // modal if iframe covers most of the viewport 45// function isModalCreative(overlay) { 46// const iframe = overlay && overlay.querySelector('#attentive_creative'); 47// if (!iframe) return false; 48// const h = parseFloat(getComputedStyle(iframe).height); 49// return h >= window.innerHeight * 0.9; // ~full-height â modal 50// } 51 52// // Show only Enable Accessibility while Attentive modal is open; restore after it's closed 53// (function () { 54// const NAV_SELS = [ 55// '.samTopNavBar', 56// '#samNewHeader_HeaderTextDiv', 57// ]; 58// const OVERLAY_ID = 'attentive_overlay'; 59// const COOKIE_ID = 'cookie_privacyPolicy'; 60// const NAV_Z = 2147483647; 61// const OVERLAY_Z = 9999; 62// const COOKIE_Z = 9998; 63// const DELAY_MS = 500; 64 65// // Hide these ONLY when modal is open 66// const HIDE_SELECTORS = [ 67// '.website-tabs__container', 68// '#samNavBarRight > *:not(:first-child)', 69// ]; 70 71// let delayTimer = null; 72 73// const isVisible = (el) => !!el && getComputedStyle(el).display !== 'none' 74// && getComputedStyle(el).visibility !== 'hidden'
75// && parseFloat(getComputedStyle(el).opacity || '1') > 0; 76 77// // Save/restore inline styles for nav wrappers 78// function saveOnce(el) { 79// if (!el || el.dataset._navSaved) return; 80// el.dataset._navSaved = '1'; 81// el.dataset._pos = el.style.position || ''; 82// el.dataset._top = el.style.top || ''; 83// el.dataset._left = el.style.left || ''; 84// el.dataset._right = el.style.right || ''; 85// el.dataset._width = el.style.width || ''; 86// el.dataset._z = el.style.zIndex || ''; 87// el.dataset._vis = el.style.visibility || ''; 88// el.dataset._bg = el.style.backgroundColor || ''; 89// } 90// function restore(el) { 91// if (!el || !el.dataset._navSaved) return; 92// el.style.position = el.dataset._pos; 93// el.style.top = el.dataset._top; 94// el.style.left = el.dataset._left; 95// el.style.right = el.dataset._right; 96// el.style.width = el.dataset._width; 97// el.style.zIndex = el.dataset._z; 98// el.style.visibility = el.dataset._vis; 99// el.style.backgroundColor = el.dataset._bg; 100// } 101 102// // Save/restore display for each hidden element 103// function saveDisplayOnce(node) { 104// if (!node || node.dataset._dispSaved) return; 105// node.dataset._dispSaved = '1'; 106// node.dataset._display = node.style.display || ''; 107// } 108// function hideNode(node) { 109// if (!node) return; 110// saveDisplayOnce(node); 111// node.style.setProperty('display', 'none', 'important'); 112// } 113// function restoreDisplay(node) { 114// if (!node || !node.dataset._dispSaved) return; 115// node.style.display = node.dataset._display; 116// } 117 118// function pinTop(el) { 119// el.style.setProperty('position', 'fixed', 'important'); 120// el.style.setProperty('top', '0', 'important'); 121// el.style.setProperty('left', '0', 'important'); 122// el.style.setProperty('right', '0', 'important'); 123// el.style.setProperty('width', '100%', 'important'); 124// el.style.setProperty('z-index', String(NAV_Z), 'important'); 125// el.style.setProperty('visibility', 'visible', 'important'); 126// // BLACK BG only while modal is open 127// el.style.setProperty('background-color', '#000', 'important'); 128// } 129 130// function hideTemporarily(el) { 131// el.style.setProperty('visibility', 'hidden', 'important'); 132// } 133 134// function apply() { 135// const overlay = document.getElementById(OVERLAY_ID); 136// const cookie = document.getElementById(COOKIE_ID); 137// const navNodes = NAV_SELS.flatMap(sel => Array.from(document.querySelectorAll(sel))); 138 139// const overlayActive = isVisible(overlay); 140// const modalActive = overlayActive && isModalCreative(overlay); // only treat true modal as active 141// const scrolledDown = (window.scrollY || window.pageYOffset || 0) > 50; 142 143// // Keep z stacking sane regardless 144// if (overlay) overlay.style.setProperty('z-index', String(OVERLAY_Z), 'important'); 145// if (cookie) cookie.style.setProperty('z-index', String(COOKIE_Z), 'important'); 146 147// // Only pin & blacken nav when MODAL is active 148// for (const nav of navNodes) { 149// if (!nav) continue; 150// if (modalActive) { 151// saveOnce(nav); 152// if (scrolledDown) { 153// hideTemporarily(nav); 154// clearTimeout(delayTimer); 155// delayTimer = setTimeout(() => pinTop(nav), DELAY_MS); 156// } else { 157// pinTop(nav); 158// } 159// } else { 160// restore(nav); 161// } 162// } 163 164// // Hide only when MODAL is active 165// const nodesToToggle = HIDE_SELECTORS.flatMap(s => Array.from(document.querySelectorAll(s))); 166// if (modalActive) { 167// nodesToToggle.forEach(hideNode); 168// } else { 169// nodesToToggle.forEach(restoreDisplay); 170// } 171 172// return { overlay }; 173// } 174 175// // ---- Hardening against Attentive re-writes ---- 176// let { overlay } = apply(); 177 178// const docObserver = new MutationObserver(() => { 179// const res = apply(); 180// if (res.overlay && res.overlay !== overlay) {
181// overlay = res.overlay; 182// lockOverlayZ(overlay); 183// } 184// }); 185// docObserver.observe(document.documentElement, { childList: true, subtree: true }); 186 187// function observeOverlayStyle(node) { 188// if (!node) return; 189// const attrObserver = new MutationObserver(() => apply()); 190// attrObserver.observe(node, { attributes: true, attributeFilter: ['style', 'class'] }); 191// } 192 193// function lockOverlayZ(node) { 194// if (!node) return; 195// const style = node.style; 196// try { 197// const ziDesc = Object.getOwnPropertyDescriptor(CSSStyleDeclaration.prototype, 'zIndex'); 198// Object.defineProperty(style, 'zIndex', { 199// configurable: true, 200// get: ziDesc && ziDesc.get ? ziDesc.get.bind(style) : () => String(OVERLAY_Z), 201// set: () => {} 202// }); 203 204// const cssTextDesc = Object.getOwnPropertyDescriptor(CSSStyleDeclaration.prototype, 'cssText'); 205// Object.defineProperty(style, 'cssText', { 206// configurable: true, 207// get: cssTextDesc.get.bind(style), 208// set: (v) => { 209// const cleaned = String(v).replace(/z-index\s*:[^;]+;?/gi, `z-index:${OVERLAY_Z}!important;`); 210// cssTextDesc.set.call(style, cleaned); 211// } 212// }); 213// } catch (_) {} 214// observeOverlayStyle(node); 215// } 216 217// lockOverlayZ(overlay); 218 219// window.addEventListener('scroll', apply, { passive: true }); 220// window.addEventListener('resize', apply); 221// window.addEventListener('orientationchange', apply); 222 223// // rAF burst then keepalive 224// let frames = 60; 225// (function loop() { 226// apply(); 227// if (frames-- > 0) requestAnimationFrame(loop); 228// })(); 229// setInterval(apply, 1500); 230// })(); 231 232// // Focus #samEnableAccessibility only if the Attentive modal is open AND not trapping focus. 233// // Also remove focus from it when the modal closes. 234// (function () { 235// const OVERLAY_ID = 'attentive_overlay'; 236// const DESKTOP_BTN_ID = '#samEnableAccessibility'; 237// const MOBILE_BTN_ID = '#samEnableAccessibilityMobile'; 238// const DESKTOP_MIN_WIDTH = 992; // desktop visible > 992px 239// const COOLDOWN = 1200; 240 241// function isModalCreative(overlay) { 242// const iframe = overlay && overlay.querySelector('#attentive_creative'); 243// if (!iframe) return false; 244// const h = parseFloat(getComputedStyle(iframe).height); 245// return h >= window.innerHeight * 0.9; 246// } 247 248// function isModalActive() { 249// const overlay = document.getElementById(OVERLAY_ID); 250// return !!overlay && isModalCreative(overlay); 251// } 252 253// function getActiveButton() { 254// // Desktop layout 255// if (window.innerWidth > DESKTOP_MIN_WIDTH) { 256// return document.querySelector(DESKTOP_BTN_ID) || null; 257// } 258// // Mobile layout 259// return document.querySelector(MOBILE_BTN_ID) || null; 260// } 261 262// // Detect if Attentive traps focus inside the overlay 263// function isFocusTrapped() { 264// return new Promise(resolve => { 265// const overlay = document.getElementById(OVERLAY_ID); 266// if (!overlay) return resolve(false); 267 268// const probe = document.createElement('button'); 269// probe.type = 'button'; 270// probe.style.cssText = 'position:fixed;left:-9999px;top:0;'; 271// document.body.appendChild(probe); 272 273// probe.focus({ preventScroll: true }); 274 275// setTimeout(() => { 276// const trapped = overlay.contains(document.activeElement); 277// probe.remove(); 278// resolve(trapped); 279// }, 120); 280// }); 281// } 282 283// let lastFocus = 0; 284// let modalWasActive = false; 285 286// async function syncFocus() { 287// const modalActive = isModalActive(); 288// const btn = getActiveButton(); 289 290// // Modal has just closed â blur the button if needed 291// if (!modalActive && modalWasActive) { 292// if (btn && document.activeElement === btn) btn.blur(); 293// } 294 295// // Modal is open â maybe focus current layout's button 296// if (modalActive && btn) { 297// if (Date.now() - lastFocus >= COOLDOWN) { 298// const trapped = await isFocusTrapped(); 299// if (!trapped) { 300// try { btn.focus({ preventScroll: true }); } catch { btn.focus(); } 301// lastFocus = Date.now();
302// } 303// } 304// } 305 306// modalWasActive = modalActive; 307// } 308 309// const tick = () => setTimeout(syncFocus, 200); 310 311// // Initial load 312// if (document.readyState === 'loading') { 313// document.addEventListener('DOMContentLoaded', tick, { once: true }); 314// } else { 315// tick(); 316// } 317 318// // Attentive re-renders nav a lot â keep watching lightly 319// new MutationObserver(tick).observe(document.documentElement, { 320// childList: true, 321// subtree: true, 322// attributes: true, 323// attributeFilter: ['style', 'class'] 324// }); 325 326// window.addEventListener('resize', tick, { passive: true }); 327// window.addEventListener('visibilitychange', tick); 328// })(); 329 330// // // Focus #samEnableAccessibility only if the Attentive modal is open AND not trapping focus. 331// // // Also remove focus from it when the modal closes. 332// // (function () { 333// // const OVERLAY_ID = 'attentive_overlay'; 334// // const BTN_SEL = '#samEnableAccessibility'; 335 336// // function isModalCreative(overlay) { 337// // const iframe = overlay && overlay.querySelector('#attentive_creative'); 338// // if (!iframe) return false; 339// // const h = parseFloat(getComputedStyle(iframe).height); 340// // return h >= window.innerHeight * 0.9; // ~full-height â modal 341// // } 342 343// // function isModalActive() { 344// // const overlay = document.getElementById(OVERLAY_ID); 345// // return !!overlay && isModalCreative(overlay); 346// // } 347 348// // // Promise<bool> â true if Attentive is trapping focus into its overlay 349// // function isFocusTrapped() { 350// // return new Promise(resolve => { 351// // const overlay = document.getElementById(OVERLAY_ID); 352// // if (!overlay) return resolve(false); 353// // const probe = document.createElement('button'); 354// // probe.type = 'button'; 355// // probe.style.cssText = 'position:fixed;left:-9999px;top:0;'; 356// // document.body.appendChild(probe); 357// // probe.focus({ preventScroll: true }); 358// // setTimeout(() => { 359// // const trapped = overlay.contains(document.activeElement); 360// // probe.remove(); 361// // resolve(trapped); 362// // }, 120); 363// // }); 364// // } 365 366// // let lastFocus = 0; 367// // let modalWasActive = false; 368// // const COOLDOWN = 1200; 369 370// // async function syncFocus() { 371// // const btn = document.querySelector(BTN_SEL); 372// // const modalActive = isModalActive(); 373 374// // // Modal just closed â if button still has focus, blur it 375// // if (!modalActive && modalWasActive && btn && document.activeElement === btn) { 376// // btn.blur(); 377// // } 378 379// // // Modal open â maybe focus button (same behavior as before) 380// // if (modalActive) { 381// // if (Date.now() - lastFocus >= COOLDOWN && btn) { 382// // const trapped = await isFocusTrapped(); 383// // if (!trapped) { 384// // try { btn.focus({ preventScroll: true }); } catch { btn.focus(); } 385// // lastFocus = Date.now(); 386// // } 387// // } 388// // } 389 390// // modalWasActive = modalActive; 391// // } 392 393// // // Light watchers (no style mutation/monkeypatching) 394// // const tick = () => setTimeout(syncFocus, 200); // give Attentive a beat to init 395 396// // if (document.readyState === 'loading') { 397// // document.addEventListener('DOMContentLoaded', tick, { once: true }); 398// // } else { 399// // tick(); 400// // } 401 402// // new MutationObserver(tick).observe(document.documentElement, { 403// // childList: true, 404// // subtree: true, 405// // attributes: true, 406// // attributeFilter: ['style', 'class'] 407// // }); 408 409// // window.addEventListener('resize', tick, { passive: true }); 410// // window.addEventListener('visibilitychange', tick); 411// // })(); 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
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.