4,456
edits
No edit summary |
No edit summary |
||
Line 1,366: | Line 1,366: | ||
// Remove “empty” optional sections so they don’t leave gaps in print. | // Remove “empty” optional sections so they don’t leave gaps in print. | ||
// --- | // --- SQUASH VERTICAL GAPS ABOVE SECTIONS (print-only) --- | ||
(function () { | (function () { | ||
var content | var css = | ||
"@media print{" + | |||
/* 1) Kill all margins/paddings on direct children inside the print content */ | |||
" #article-content > *{margin:0!important;padding:0!important;}" + | |||
/* 2) Ensure paragraphs inside rich text don’t re-introduce big gaps */ | |||
" .article-description p,.article-reflection p,.article-external-reference p,.article-quote p{margin:0!important;}" + | |||
" .article-description p + p,.article-reflection p + p{margin-top:1.2mm!important;}" + | |||
/* 3) All ruled blocks: keep only a tiny bottom padding for the hairline */ | |||
" .article-entry-number," + | |||
" .link-pdf," + | |||
" .article-type," + | |||
" .article-metadata," + | |||
" .article-images," + | |||
" .article-description," + | |||
" .article-reflection," + | |||
" .article-external-reference," + | |||
" .article-quote," + | |||
" .article-mod-line{" + | |||
" padding-bottom:1.2mm!important;" /* space for the hairline */ + | |||
" }" + | |||
/* 4) Labels: zero their own top margin by default */ | |||
" .article-label-description," + | |||
" .article-label-reflection," + | |||
" .article-label-external-reference," + | |||
" .article-label-quote," + | |||
" .article-label-modification-date{" + | |||
" margin-top:0!important;" + | |||
" }" + | |||
/* 5) Add ONE uniform spacer above labels when they follow any ruled block */ | |||
" .article-entry-number + .article-label-description," + | |||
" .link-pdf + .article-label-description," + | |||
" .article-type + .article-label-description," + | |||
" .article-metadata + .article-label-description," + | |||
" .article-images + .article-label-description," + | |||
" .article-description + .article-label-reflection," + | |||
" .article-reflection + .article-label-external-reference," + | |||
" .article-external-reference + .article-label-quote," + | |||
" .article-quote + .article-label-modification-date{" + | |||
" margin-top:1.2mm!important;" /* <- tweak this single value to taste */ + | |||
" }" + | |||
/* 6) Also no extra gap between a label and its body */ | |||
" .article-label-description + .article-description," + | |||
" .article-label-reflection + .article-reflection," + | |||
" .article-label-external-reference + .article-external-reference," + | |||
" .article-label-quote + .article-quote," + | |||
" .article-label-modification-date + .article-modification-date{" + | |||
" margin-top:0!important;" + | |||
" }" + | |||
/* 7) Last block on the page: remove rule/padding to avoid tail gap */ | |||
" #article-content > :last-child{padding-bottom:0!important;}" + | |||
" #article-content > :last-child::after{content:none!important;}" + | |||
"}"; | |||
var style = doc.createElement("style"); | |||
style.type = "text/css"; | |||
style.appendChild(doc.createTextNode(css)); | |||
doc.head.appendChild(style); | |||
doc.head.appendChild( | |||
})(); | })(); | ||
Line 1,778: | Line 1,725: | ||
if (submitButton) { | if (submitButton) { | ||
// Add click event listener | // Add click event listener | ||
submitButton.addEventListener("click", function (event) { | submitButton.addEventListener("click", function (event) { |