update
This commit is contained in:
parent
a68d52d5b2
commit
77bdb498d9
3 changed files with 14 additions and 90 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "the-fold-within",
|
"name": "the-fold-within",
|
||||||
"version": "3.0.5",
|
"version": "3.0.2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pdf-parse": "^1.1.1"
|
"pdf-parse": "^1.1.1"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -265,52 +265,13 @@ function renderIframe(rel) {
|
||||||
const doc = iframe.contentDocument;
|
const doc = iframe.contentDocument;
|
||||||
const style = doc.createElement("style");
|
const style = doc.createElement("style");
|
||||||
style.textContent = `
|
style.textContent = `
|
||||||
html,body {
|
html,body{background:#0b0b0b;color:#e6e3d7;font-family:Inter,sans-serif;
|
||||||
background:#0b0b0b;
|
margin:0;padding:2rem;}
|
||||||
color:#e6e3d7;
|
*{max-width:720px;margin:auto;}
|
||||||
font-family:Inter,sans-serif;
|
img,video,iframe{max-width:100%;height:auto;}
|
||||||
margin:0;
|
|
||||||
padding:3vh 6vw;
|
|
||||||
line-height:1.8;
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
display:flex;
|
|
||||||
flex-direction:column;
|
|
||||||
align-items:center;
|
|
||||||
justify-content:flex-start;
|
|
||||||
min-height:100vh;
|
|
||||||
}
|
|
||||||
* {
|
|
||||||
max-width:960px;
|
|
||||||
width:100%;
|
|
||||||
}
|
|
||||||
img,video,iframe {
|
|
||||||
max-width:100%;
|
|
||||||
height:auto;
|
|
||||||
border-radius:8px;
|
|
||||||
}
|
|
||||||
/* remove internal scrollbars */
|
|
||||||
html { overflow:hidden; }
|
|
||||||
`;
|
`;
|
||||||
doc.head.appendChild(style);
|
doc.head.appendChild(style);
|
||||||
|
} catch {}
|
||||||
// Inject auto-height script with debounce
|
|
||||||
const script = doc.createElement("script");
|
|
||||||
script.textContent = `
|
|
||||||
let timeout;
|
|
||||||
function sendHeight() {
|
|
||||||
clearTimeout(timeout);
|
|
||||||
timeout = setTimeout(() => {
|
|
||||||
window.parent.postMessage({ type: 'resizeFrame', height: document.body.scrollHeight + 20 }, '*');
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
new ResizeObserver(sendHeight).observe(document.body);
|
|
||||||
window.addEventListener('load', sendHeight);
|
|
||||||
`;
|
|
||||||
doc.body.appendChild(script);
|
|
||||||
} catch (e) {
|
|
||||||
console.warn("iframe load error", e);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -325,13 +286,4 @@ function renderDefault() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("message", e => {
|
|
||||||
if (e.data?.type === "resizeFrame") {
|
|
||||||
const iframe = document.querySelector("iframe[src*='" + location.hash.replace(/^#\//, "") + "']");
|
|
||||||
if (iframe) {
|
|
||||||
iframe.style.height = e.data.height + "px";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
|
||||||
|
|
@ -190,47 +190,19 @@ body.sidebar-open #sidebar { transform: translateX(0); }
|
||||||
to { opacity: 1; transform: translateY(0); }
|
to { opacity: 1; transform: translateY(0); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* === DYNAMIC BREATHING FRAME === */
|
.viewer iframe {
|
||||||
.preview-wrapper {
|
width: 100%; height: calc(100vh - var(--topbar-h) - var(--subnav-h) - 80px);
|
||||||
display: flex;
|
border: 0; border-radius: var(--radius); background: transparent;
|
||||||
flex-direction: column;
|
display: block;
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-start;
|
|
||||||
gap: 0;
|
|
||||||
padding: 1rem 0 3rem 0;
|
|
||||||
min-height: calc(100vh - var(--topbar-h) - var(--subnav-h));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* === POP-OUT PREVIEW === */
|
||||||
.preview-header {
|
.preview-header {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
width: 100%;
|
background: rgba(224,184,75,0.08);
|
||||||
max-width: 960px;
|
|
||||||
background: rgba(224,184,75,0.06);
|
|
||||||
border-bottom: 1px solid #333;
|
border-bottom: 1px solid #333;
|
||||||
padding: .6rem 1rem;
|
padding: .4rem 1rem;
|
||||||
box-shadow: 0 2px 4px rgba(0,0,0,0.4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.viewer iframe {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
max-width: 960px;
|
|
||||||
min-height: 500px;
|
|
||||||
border: 0;
|
|
||||||
border-radius: var(--radius);
|
|
||||||
background: #0b0b0b;
|
|
||||||
box-shadow: 0 0 30px rgba(0,0,0,0.6);
|
|
||||||
margin: 0 auto 3rem auto;
|
|
||||||
transition: height .4s ease, transform .4s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.viewer iframe {
|
|
||||||
max-width: 100%;
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.popout-btn {
|
.popout-btn {
|
||||||
background: none;
|
background: none;
|
||||||
border: 1px solid var(--accent);
|
border: 1px solid var(--accent);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue