4,456
edits
No edit summary |
No edit summary |
||
Line 1,370: | Line 1,370: | ||
// Remove “empty” optional sections so they don’t leave gaps in print. | // Remove “empty” optional sections so they don’t leave gaps in print. | ||
// | // Kill UA paragraph margins & set compact rhythm inside the print iframe | ||
var compactCSS = doc.createElement("style"); | |||
compactCSS.textContent = ` | |||
@media print { | |||
/* nuke default <p> margins everywhere in the printable area */ | |||
.print-only p { margin: 0 !important; } | |||
// | /* compact vertical rhythm between top-level blocks */ | ||
#article-content > * { margin-top: 0 !important; margin-bottom: 0 !important; } | |||
/ | /* small, consistent space only between siblings (tweak as you like) */ | ||
#article-content > * + * { margin-top: 2mm !important; } | |||
/* paragraphs inside text sections: very small trailing space */ | |||
.article-description p, | |||
.article-reflection p, | |||
.article-external-reference p, | |||
.article-quote { margin: 0 0 1.2mm 0 !important; } | |||
.article-description p:last-child, | |||
.article-reflection p:last-child, | |||
.article-external-reference p:last-child { margin-bottom: 0 !important; } | |||
/* labels sit tight with the block that follows */ | |||
.article-label-description, | |||
.article-label-reflection, | |||
.article-label-external-reference, | |||
.article-label-quote, | |||
.article-label-modification-date { margin: 0 !important; } | |||
/* hairline sections already use padding-bottom; | |||
make sure there's no extra margin on either side */ | |||
.article-entry-number, | |||
.link-pdf, | |||
.article-type, | |||
.article-metadata, | |||
.article-images, | |||
.article-description, | |||
.article-reflection, | |||
.article-external-reference, | |||
.article-quote, | |||
.article-mod-line { margin: 0 !important; } | |||
} | |||
`; | |||
doc.head.appendChild(compactCSS); | |||
// --- PDF-friendly links for Chrome on macOS --- | // --- PDF-friendly links for Chrome on macOS --- |