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:
+1
-1
@@ -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"
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user