/* ========================================================= EMERALD QUICK SHIP P13 FINAL LOCK OVERLAY | NOVEMBER 15, 2026 ========================================================= TEST PAGE: /category/1366566-Desks.html REQUIRED SCRIPTS: 1. P10 Native Shopping Readiness Monitor 2. P9 Persistent Native Desks 3. P13-E Consolidated Desks 4. THIS SCRIPT APPROVED DESIGN: - Four compact columns - 200x200 native-resolution images - 14px bold product titles - 11.5px feature descriptions - 9px green bullet markers - 11px muted metadata - 26px selling prices - 12px raised cents - Verified manufacturer list prices - Emerald Savings right aligned - Original closeout badge and tooltip - Native quantity and Add to Cart - Final 8px pricing position SAFETY: - Desks test page only - No native selling-price changes - No cart-handler replacement - No changes to P9 or P10 - No Footer Master changes - Reversible overlay ========================================================= */ (() => { 'use strict'; const VERSION = 'P13_FINAL_LOCK_2026_11_15'; const PAGE = /^\/category\/1366566-desks(?:\.html)?\/?$/i; if (!PAGE.test(location.pathname)) { return; } if (window.EQS_P13_FINAL?.active) { console.info('[P13 FINAL] Already active.'); return; } const ROOT = '.griditems.gridlist-grid.clearfix'; const CARD = '.tileparent.product.eqs-p542'; const STYLE_ID = 'eqs-p13-final-lock-css'; /* VERIFIED MANUFACTURER LIST PRICES These four records are confirmed. Native EvolutionX selling prices are never changed. Additional SKUs will be integrated separately. */ const DATA = { COEMARKLE68W: { list: 6068, features: [ 'Drop-front keyboard drawer', 'Built-in wire-management grommets', 'Two locking file drawers' ] }, COEDBLFLOS105MA: { list: 2868, features: [ 'Durable laminate work surface', 'Double-pedestal storage', 'Locking file drawers' ] }, COEDBLFLOS105MH: { list: 2868, features: [ 'Durable laminate work surface', 'Double-pedestal storage', 'Locking file drawers' ] }, COEDBLFLOS105MW: { list: 2868, features: [ 'Durable laminate work surface', 'Double-pedestal storage', 'Locking file drawers' ] } }; const records = new Map(); const review = new Map(); let observer; let queued = false; let scans = 0; /* ======================================================= APPROVED CSS ======================================================= */ const CSS = ` /* FOUR-COLUMN CARD LAYOUT */ ${ROOT} { display:flex!important; flex-wrap:wrap!important; align-items:stretch!important; gap:0!important; } ${ROOT} > ${CARD} { box-sizing:border-box!important; flex:0 0 calc(25% - 12px)!important; width:calc(25% - 12px)!important; max-width:calc(25% - 12px)!important; min-width:0!important; margin:0 6px 14px!important; float:none!important; } /* COMPACT CARD PADDING */ ${CARD} > .tile { padding-top:0!important; padding-bottom:8px!important; } /* NATIVE 200PX IMAGE SIZE */ ${CARD} .product-tile-image, ${CARD} .product-tile-image .text-center, ${CARD} .imgthumbnail { height:175px!important; min-height:175px!important; max-height:175px!important; display:flex!important; align-items:center!important; justify-content:center!important; overflow:visible!important; } ${CARD} .product-tile-image img { width:200px!important; height:200px!important; min-width:200px!important; min-height:200px!important; max-width:200px!important; max-height:200px!important; object-fit:contain!important; object-position:center!important; margin:0 auto!important; } /* MANUFACTURER LOGO AND DELIVERY */ ${CARD} .eqs-p542-brandrow { margin-top:12px!important; margin-bottom:1px!important; min-height:32px!important; } /* FINAL PRODUCT TITLE TYPOGRAPHY */ ${CARD} .product-name { margin-top:0!important; margin-bottom:2px!important; } ${CARD} .product-name, ${CARD} .product-name a { font-size:14px!important; line-height:19px!important; font-weight:700!important; } /* FINAL FEATURE BULLETS */ ${CARD} .eqs-p13e-features { margin-top:0!important; margin-bottom:3px!important; gap:1px!important; } ${CARD} .eqs-p13e-feature { font-size:11.5px!important; line-height:16px!important; } ${CARD} .eqs-p13e-feature::before { font-size:9px!important; line-height:16px!important; } /* FINAL SOFT METADATA */ ${CARD} .eqs-p13e-meta { margin-bottom:2px!important; gap:0!important; } ${CARD} .eqs-p13e-meta, ${CARD} .eqs-p13e-meta span { font-size:11px!important; line-height:17px!important; font-weight:400!important; color:#64748B!important; } ${CARD} .eqs-p13e-meta b { font-size:11px!important; font-weight:600!important; color:#475569!important; } ${CARD} .eqs-p13e-meta .eqs-p13e-category { color:#438A62!important; font-weight:500!important; } /* PRICE AREA */ ${CARD} .eqs-r2-pricebar { box-sizing:border-box!important; display:flex!important; align-items:flex-end!important; justify-content:space-between!important; gap:5px!important; width:100%!important; max-width:100%!important; min-width:0!important; min-height:0!important; margin-top:auto!important; margin-bottom:4px!important; transform:translateY(8px)!important; overflow:visible!important; } ${CARD} .eqs-r2-left { box-sizing:border-box!important; flex:0 1 auto!important; min-width:0!important; max-width:65%!important; } /* VERIFIED MANUFACTURER LIST PRICE */ ${CARD} .eqs-r2-list { font:11px/14px Arial,sans-serif!important; color:#475467!important; white-space:nowrap!important; margin-bottom:1px!important; } ${CARD} .eqs-r2-list s { color:#667085!important; text-decoration-thickness:1px!important; } /* APPROVED 26PX SELLING PRICE */ ${CARD} .eqs-r2-display { display:inline-flex!important; align-items:flex-start!important; color:#43854A!important; font-family:Arial,sans-serif!important; font-size:26px!important; line-height:31px!important; font-weight:800!important; letter-spacing:-0.5px!important; white-space:nowrap!important; } /* RAISED CENTS */ ${CARD} .eqs-r2-cents { font-family:Arial,sans-serif!important; font-size:12px!important; line-height:1!important; font-weight:800!important; letter-spacing:0!important; margin-top:1px!important; margin-left:1px!important; } /* EMERALD SAVINGS */ ${CARD} .eqs-r2-savings { box-sizing:border-box!important; flex:0 0 auto!important; width:auto!important; max-width:40%!important; min-width:0!important; margin:0 0 2px auto!important; text-align:right!important; white-space:nowrap!important; color:#64748B!important; } ${CARD} .eqs-r2-label { font:600 9px/12px Arial,sans-serif!important; color:#64748B!important; } ${CARD} .eqs-r2-percent { font:500 13px/17px Arial,sans-serif!important; color:#64748B!important; } /* HIDE NATIVE PRICE VISUALLY, KEEP ORIGINAL ELEMENT IN DOM */ ${CARD} .eqs-r2-native { position:absolute!important; width:1px!important; height:1px!important; min-height:0!important; overflow:hidden!important; clip-path:inset(50%)!important; } /* ORIGINAL CLOSEOUT BADGE */ ${CARD} .eqs-r6-price-line { display:flex!important; align-items:center!important; gap:2px!important; max-width:100%!important; white-space:nowrap!important; } ${CARD} .eqs-r6-price-line .emerald-closeout-deal-badge { position:static!important; display:inline-flex!important; width:auto!important; height:auto!important; margin:0!important; padding:0!important; flex:0 0 auto!important; background:transparent!important; border:0!important; box-shadow:none!important; font-size:0!important; cursor:pointer!important; pointer-events:auto!important; } ${CARD} .eqs-r6-price-line .emerald-closeout-deal-badge span { display:none!important; } ${CARD} .eqs-r6-price-line .emerald-closeout-deal-badge svg { display:block!important; width:14px!important; height:14px!important; } /* NATIVE SHOPPING CONTROLS */ ${CARD} .buttons.group { height:44px!important; min-height:44px!important; margin-top:0!important; position:relative!important; z-index:1!important; } ${CARD} .inputquantity, ${CARD} .btn-add-to-cart { height:44px!important; min-height:44px!important; } /* RESPONSIVE */ @media(max-width:1100px) { ${ROOT} > ${CARD} { flex-basis:calc(50% - 12px)!important; width:calc(50% - 12px)!important; max-width:calc(50% - 12px)!important; } } @media(max-width:600px) { ${ROOT} > ${CARD} { flex-basis:calc(100% - 12px)!important; width:calc(100% - 12px)!important; max-width:calc(100% - 12px)!important; } } `; /* ======================================================= INSTALL STYLES ======================================================= */ const style = document.createElement('style'); style.id = STYLE_ID; style.textContent = CSS; document.head.appendChild(style); /* ======================================================= HELPERS ======================================================= */ function formatMoney(value) { return '$' + Number(value).toLocaleString('en-US', { minimumFractionDigits:2, maximumFractionDigits:2 }); } function skuOf(card) { return (card.dataset.sku || '') .trim() .toUpperCase(); } function nativePrice(card) { const label = card.querySelector( '.footer-wrapper-price .price-label' ); if (!label) return null; const raw = label.getAttribute('data-value'); if (raw !== null && raw.trim() !== '') { const value = Number(raw); if (Number.isFinite(value)) { return value; } } const text = label.textContent || ''; const match = text.replace(/,/g, '').match( /\$\s*(\d+(?:\.\d{1,2})?)/ ); return match ? Number(match[1]) : null; } function nativeUOM(card) { const pack = (card.dataset.packUom || '') .trim() .toUpperCase(); const visible = card.querySelector( '.footer-wrapper-price .uomvalue' ); const display = (visible?.textContent || '') .replace(/[\s/]/g, '') .toUpperCase(); if (pack && display && pack !== display) { return 'MISMATCH'; } return display || pack; } /* ======================================================= CREATE APPROVED CARD PRESENTATION ======================================================= */ function apply(card) { if (records.has(card)) return; const sku = skuOf(card); const item = DATA[sku]; // Only the four verified test SKUs receive // the custom pricing presentation at this stage. if (!item) return; const features = card.querySelector( '.eqs-p13e-features' ); const stack = card.querySelector( '.eqs-p13e-pricestack' ); const native = stack?.querySelector( '.footer-wrapper-price' ); if (!features || !stack || !native) return; // Avoid duplicate overlay markup. if (stack.querySelector('.eqs-r2-pricebar')) return; const savedFeatures = features.innerHTML; /* APPROVED THREE FEATURES */ features.replaceChildren(); item.features.forEach(value => { const row = document.createElement('div'); row.className = 'eqs-p13e-feature'; row.textContent = value; features.appendChild(row); }); /* PRICE BAR */ const bar = document.createElement('div'); bar.className = 'eqs-r2-pricebar'; const left = document.createElement('div'); left.className = 'eqs-r2-left'; const list = document.createElement('div'); list.className = 'eqs-r2-list'; list.append( document.createTextNode('List Price: ') ); const strike = document.createElement('s'); strike.textContent = formatMoney(item.list); list.appendChild(strike); /* PRICE LINE */ const line = document.createElement('div'); line.className = 'eqs-r6-price-line'; const display = document.createElement('div'); display.className = 'eqs-r2-display'; /* EMERALD SAVINGS */ const savings = document.createElement('div'); savings.className = 'eqs-r2-savings'; const savingsLabel = document.createElement('div'); savingsLabel.className = 'eqs-r2-label'; savingsLabel.textContent = 'Your Emerald Savings'; const savingsValue = document.createElement('div'); savingsValue.className = 'eqs-r2-percent'; savings.append( savingsLabel, savingsValue ); /* PRESERVE ORIGINAL CLOSEOUT BADGE */ const badge = native.querySelector( '.emerald-closeout-deal-badge' ); const badgeParent = badge?.parentNode || null; const badgeNext = badge?.nextSibling || null; if (badge) { line.appendChild(badge); } line.appendChild(display); left.append(list, line); bar.append(left, savings); stack.insertBefore(bar, native); /* Save original state for rollback. */ records.set(card, { sku, item, features, savedFeatures, stack, native, bar, list, display, savings, savingsValue, badge, badgeParent, badgeNext, nativeWasHidden: native.classList.contains('eqs-r2-native') }); update(card); } /* ======================================================= UPDATE VISUAL PRICE FROM NATIVE EVOLUTIONX ======================================================= */ function update(card) { const r = records.get(card); if (!r) return; const sell = nativePrice(card); const uom = nativeUOM(card); /* Invalid price or mismatched UOM: restore native price presentation. */ if ( !Number.isFinite(sell) || sell <= 0 || uom !== 'EA' ) { r.bar.style.display = 'none'; r.native.classList.remove('eqs-r2-native'); // Keep closeout indicator with native price // whenever the custom presentation is disabled. if (r.badge && r.badgeParent && r.badge.parentNode !== r.badgeParent) { r.badgeParent.insertBefore( r.badge, r.badgeNext?.parentNode === r.badgeParent ? r.badgeNext : null ); } review.set( r.sku, uom !== 'EA' ? 'UOM mismatch' : 'Invalid native selling price' ); return; } r.bar.style.display = ''; r.native.classList.add('eqs-r2-native'); // Restore closeout badge to custom price line // after any previous invalid-price state. if (r.badge && r.badge.parentNode !== r.bar.querySelector( '.eqs-r6-price-line' )) { r.bar.querySelector( '.eqs-r6-price-line' ).prepend(r.badge); } /* Format native selling price. Original EvolutionX price remains untouched. */ const formatted = formatMoney(sell); if (r.display.dataset.amount !== formatted) { const parts = formatted.split('.'); const cents = document.createElement('span'); cents.className = 'eqs-r2-cents'; cents.textContent = parts[1] || '00'; r.display.replaceChildren( document.createTextNode(parts[0] + '.'), cents ); r.display.dataset.amount = formatted; } /* Verified savings calculation. Never force a discount percentage. */ const discount = ( 1 - sell / r.item.list ) * 100; const verified = Number.isFinite(discount) && r.item.list > 0 && discount >= 36; r.list.style.display = verified ? '' : 'none'; r.savings.style.display = verified ? '' : 'none'; if (verified) { r.savingsValue.textContent = Math.round(discount) + '% off list'; review.delete(r.sku); } else { r.savingsValue.textContent = ''; review.set( r.sku, 'Actual discount below 36%' ); } } /* ======================================================= SCAN CARDS ======================================================= */ function scan() { scans++; document.querySelectorAll(CARD).forEach(card => { apply(card); update(card); }); for (const card of records.keys()) { if (!card.isConnected) { records.delete(card); } } } /* ======================================================= MONITOR NEW NATIVE CARDS AND PRICE CHANGES ======================================================= */ observer = new MutationObserver(mutations => { if (queued) return; const relevant = mutations.some(m => { if ( m.type === 'characterData' || m.type === 'attributes' ) { const target = m.target.nodeType === 1 ? m.target : m.target.parentElement; return !!target?.closest?.( '.footer-wrapper-price' ); } if (m.type === 'childList') { const target = m.target.nodeType === 1 ? m.target : m.target.parentElement; if (target?.closest?.( '.footer-wrapper-price' )) { return true; } return [...m.addedNodes].some(node => node.nodeType === 1 && ( node.matches?.('.tileparent.product') || node.querySelector?.('.tileparent.product') ) ); } return false; }); if (!relevant) return; queued = true; requestAnimationFrame(() => { queued = false; scan(); }); }); observer.observe(document.body, { childList:true, subtree:true, characterData:true, attributes:true, attributeFilter:['data-value'] }); /* ======================================================= ROLLBACK ======================================================= */ function remove() { observer.disconnect(); for (const r of records.values()) { /* Restore original features. */ r.features.innerHTML = r.savedFeatures; /* Restore original closeout badge. */ if (r.badge && r.badgeParent) { if ( r.badgeNext && r.badgeNext.parentNode === r.badgeParent ) { r.badgeParent.insertBefore( r.badge, r.badgeNext ); } else { r.badgeParent.appendChild(r.badge); } } /* Restore native price visibility. */ if (!r.nativeWasHidden) { r.native.classList.remove('eqs-r2-native'); } r.bar.remove(); } records.clear(); review.clear(); style.remove(); delete window.EQS_P13_FINAL; console.info( '[P13 FINAL] Overlay removed. P13-E retained.' ); } /* ======================================================= STATUS ======================================================= */ function status() { const cards = [ ...document.querySelectorAll(CARD) ]; const firstFour = cards.slice(0, 4); return { version:VERSION, nativeCards:document.querySelectorAll( '.tileparent.product' ).length, styledCards:cards.length, overlayCards:records.size, verifiedListRecords:Object.keys(DATA).length, verifiedSavingsClaims:[ ...records.values() ].filter(r => r.savings.style.display !== 'none' && !!r.savingsValue.textContent ).length, firstFourFeatureCounts:firstFour.map(card => card.querySelectorAll( '.eqs-p13e-feature' ).length ), firstFourPrices:firstFour.map(card => card.querySelector( '.eqs-r2-display' )?.textContent || null ), firstFourPriceFontSizes:firstFour.map(card => { const el = card.querySelector( '.eqs-r2-display' ); return el ? getComputedStyle(el).fontSize : null; }), closeoutPreserved:!!document.querySelector( '.eqs-r6-price-line .emerald-closeout-deal-badge' ), nativeCartButtons:document.querySelectorAll( '.tileparent.product .btn-add-to-cart' ).length, review:[...review].map(([sku,reason]) => ({ sku, reason })), scans }; } /* ======================================================= PUBLIC TEST CONTROLS ======================================================= */ window.EQS_P13_FINAL = { active:true, version:VERSION, status, rescan:scan, remove }; /* Initial scan. */ scan(); console.info( '[P13 FINAL LOCK] Initialized', status() ); })();