Skip to content

Commit

Permalink
Added On3 iframe
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Mar 1, 2024
1 parent 23f109e commit c04c61a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
18 changes: 7 additions & 11 deletions iframe/2/on3.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,23 @@
document.body.innerHTML = `<iframe loading="eager" onload="contentWindow.postMessage('','*')" scrolling="no" src="//embed.on3.com/db/${location.hash.replace(/[^-\w]/g, '')}/industry-comparison/" style="border:0;height:100vh;width:100%"></iframe>`;
};

let height, port;
let port;
window.onmessage = (e) =>
{
e.stopImmediatePropagation();

if (e.data === 's9e:init' && !port)
{
port = e.ports[0];

return;
}

let m = /"height":([1-9]+\d*)/.exec(e.data);
if (m)
else
{
height = m[1];
}
let height = +e.data.height;

if (height && port)
{
port.postMessage(height);
if (height && port)
{
port.postMessage(height);
}
}
};
})(document, window);
Expand Down
2 changes: 1 addition & 1 deletion iframe/2/on3.min.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><title>Content from On3</title><body style=margin:0><script>((e,d)=>{d.onload=()=>{e.body.innerHTML=`<iframe loading=eager onload="contentWindow.postMessage('','*')" scrolling=no src="//embed.on3.com/db/${location.hash.replace(/[^-\w]/g,'')}/industry-comparison/" style=border:0;height:100vh;width:100%></iframe>`};let c,b;d.onmessage=a=>{a.stopImmediatePropagation();'s9e:init'!==a.data||b?((a=/"height":([1-9]+\d*)/.exec(a.data))&&(c=a[1]),c&&b&&b.postMessage(c)):b=a.ports[0]}})(document,window)</script>
<!DOCTYPE html><title>Content from On3</title><body style=margin:0><script>((d,c)=>{c.onload=()=>{d.body.innerHTML=`<iframe loading=eager onload="contentWindow.postMessage('','*')" scrolling=no src="//embed.on3.com/db/${location.hash.replace(/[^-\w]/g,'')}/industry-comparison/" style=border:0;height:100vh;width:100%></iframe>`};let b;c.onmessage=a=>{a.stopImmediatePropagation();'s9e:init'!==a.data||b?(a=+a.data.height)&&b&&b.postMessage(a):b=a.ports[0]}})(document,window)</script>

0 comments on commit c04c61a

Please sign in to comment.