MC/website/web/oscommerce-inner.js
2026-11-27 23:43:05 +00:00

1 line
781 B
JavaScript

(()=>{if(window.parent===window)return;const allowed=new Set(['https://shop.dunerealms.com','https://www.dunerealms.com','https://dunerealms.com','https://cp.dunerealms.com']);let origin;try{origin=new URL(document.referrer).origin;}catch{}if(!allowed.has(origin))return;let queued=false,last=0;const send=()=>{if(queued)return;queued=true;requestAnimationFrame(()=>{queued=false;const height=Math.ceil(document.body.getBoundingClientRect().height);if(height>=100&&Math.abs(height-last)>2){last=height;parent.postMessage({type:'dune-shop-size',height},origin);}});};window.addEventListener('message',e=>{if(e.origin===origin&&e.source===parent&&e.data?.type==='dune-shop-measure')send();});window.addEventListener('load',send);new ResizeObserver(send).observe(document.body);})();