v3.0.4 – Adaptive Frame of Stillness
Dynamic iframe resizing via postMessage handshake. Perfect centering restored. Infinite recursion made visible.
This commit is contained in:
parent
e74d6de19d
commit
a68d52d5b2
2 changed files with 7 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "the-fold-within",
|
"name": "the-fold-within",
|
||||||
"version": "3.0.4",
|
"version": "3.0.5",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pdf-parse": "^1.1.1"
|
"pdf-parse": "^1.1.1"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -294,11 +294,15 @@ function renderIframe(rel) {
|
||||||
`;
|
`;
|
||||||
doc.head.appendChild(style);
|
doc.head.appendChild(style);
|
||||||
|
|
||||||
// Inject auto-height script
|
// Inject auto-height script with debounce
|
||||||
const script = doc.createElement("script");
|
const script = doc.createElement("script");
|
||||||
script.textContent = `
|
script.textContent = `
|
||||||
|
let timeout;
|
||||||
function sendHeight() {
|
function sendHeight() {
|
||||||
window.parent.postMessage({ type: 'resizeFrame', height: document.body.scrollHeight }, '*');
|
clearTimeout(timeout);
|
||||||
|
timeout = setTimeout(() => {
|
||||||
|
window.parent.postMessage({ type: 'resizeFrame', height: document.body.scrollHeight + 20 }, '*');
|
||||||
|
}, 100);
|
||||||
}
|
}
|
||||||
new ResizeObserver(sendHeight).observe(document.body);
|
new ResizeObserver(sendHeight).observe(document.body);
|
||||||
window.addEventListener('load', sendHeight);
|
window.addEventListener('load', sendHeight);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue