Skip to content

Commit

Permalink
Added Pinterest iframe v3
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Jun 25, 2024
1 parent 8191e7d commit 964821a
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
1 change: 1 addition & 0 deletions iframe/3/minify.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,5 @@ function ($m)
}
}
chdir(__DIR__);
minifyDir(__DIR__);
66 changes: 66 additions & 0 deletions iframe/3/pinterest.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE html>
<title>Content from Pinterest</title>
<body style="margin:0"><div><a data-pin-board-width="900" data-pin-width="medium" data-pin-scale-height="360"></a></div>
<script>
((window) =>
{
((a, url, id, type) =>
{
if (/^\d+$/.test(id))
{
url += 'pin/';
type += 'Pin';
}
else
{
type += 'Board';
}
a.href = url + id;
a.setAttribute('data-pin-do', type);
})(/** @type {!HTMLAnchorElement} */ (document.querySelector('a')), 'https://www.pinterest.com/', window.location.hash.substring(1), 'embed');

window.onmessage = (e) =>
{
if (e.data !== 's9e:init:3')
{
return;
}

let delay = 48,
height = 0,
port = e.ports[0],
timeoutId = 0;
function getHeight()
{
return Math.ceil(document.documentElement.getBoundingClientRect().height);
}
function checkHeight()
{
if (height === (height = getHeight()) || height < 90)
{
delay += 12;
}
else
{
port.postMessage({ 'method': 'resize', 'height': height });
}
if (delay < 1000)
{
schedule();
}
}
function schedule()
{
clearTimeout(timeoutId);
timeoutId = setTimeout(checkHeight, delay);
}
window.onclick = window.onresize = () =>
{
delay = 48;
schedule();
};
schedule();
};
})(window);
</script>
<script src="//assets.pinterest.com/js/pinit.js"></script>
1 change: 1 addition & 0 deletions iframe/3/pinterest.min.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><title>Content from Pinterest</title><body style=margin:0><div><a data-pin-board-width=900 data-pin-width=medium data-pin-scale-height=360></a></div><script>(d=>{((c,e,b,a)=>{/^\d+$/.test(b)?(e+='pin/',a+='Pin'):a+='Board';c.href=e+b;c.setAttribute('data-pin-do',a)})(document.querySelector('a'),'https://www.pinterest.com/',d.location.hash.substring(1),'embed');d.onmessage=c=>{function e(){f===(f=Math.ceil(document.documentElement.getBoundingClientRect().height))||90>f?a+=12:h.postMessage({method:'resize',height:f});1E3>a&&b()}function b(){clearTimeout(g);g=setTimeout(e,a)}if('s9e:init:3'===c.data){var a=48,f=0,h=c.ports[0],g=0;d.onclick=d.onresize=()=>{a=48;b()};b()}}})(window)</script><script src=//assets.pinterest.com/js/pinit.js></script>

0 comments on commit 964821a

Please sign in to comment.