Skip to content

Commit

Permalink
Updated Medium v3
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Jun 23, 2024
1 parent cbcbed7 commit 66089c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions iframe/3/medium.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@
port.postMessage({ 'method': 'forward' });
port.onmessage = (e) =>
{
let m = /^m::\d+::(\d+)$/.exec(e.data);
if (m)
if (e.data['method'] === 'message')
{
// Add 5 px for border + shadow
port.postMessage({ 'method': 'resize', 'height': +m[1] + 5 });
let m = /^m::\d+::(\d+)$/.exec(e.data);
if (m)
{
// Add 5 px for border + shadow
port.postMessage({ 'method': 'resize', 'height': +m[1] + 5 });
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion iframe/3/medium.min.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><title>Content from Medium</title><style>iframe{border:1px solid;border-color:#eee #ddd #bbb;border-radius:5px;box-shadow:#00000026 0 1px 3px;height:calc(100vh - 5px);width:calc(100% - 2px)}</style><body style=margin:0><script>((d,e)=>{let a;e.onmessage=f=>{if('s9e:init'===f.data&&!a){var b=d.createElement('iframe');b.loading='eager';b.scrolling='no';b.src='https://api.medium.com/embed?type=story&path=%2F%40%2F'+e.location.hash.replace(/\W/g,'');a=f.ports[0];a.postMessage({method:'forward'});a.onmessage=c=>{(c=/^m::\d+::(\d+)$/.exec(c.data))&&a.postMessage({method:'resize',height:+c[1]+5})};d.body.append(b)}}})(document,window)</script>
<!DOCTYPE html><title>Content from Medium</title><style>iframe{border:1px solid;border-color:#eee #ddd #bbb;border-radius:5px;box-shadow:#00000026 0 1px 3px;height:calc(100vh - 5px);width:calc(100% - 2px)}</style><body style=margin:0><script>((d,e)=>{let a;e.onmessage=f=>{if('s9e:init'===f.data&&!a){var b=d.createElement('iframe');b.loading='eager';b.scrolling='no';b.src='https://api.medium.com/embed?type=story&path=%2F%40%2F'+e.location.hash.replace(/\W/g,'');a=f.ports[0];a.postMessage({method:'forward'});a.onmessage=c=>{'message'===c.data.method&&(c=/^m::\d+::(\d+)$/.exec(c.data))&&a.postMessage({method:'resize',height:+c[1]+5})};d.body.append(b)}}})(document,window)</script>

0 comments on commit 66089c2

Please sign in to comment.