fix: restore print media query functionality

Removes CDN global styles before printing via beforeprint/afterprint
events, preventing the witchy theme from bleeding into print output.
Fixes print layout: centred name and contact info, reset margins for
compact sub-position lists, and footer z-index for screen view.
This commit is contained in:
2026-04-20 12:10:18 -07:00
committed by Naomi Carrigan
parent 8ed53738e0
commit 7b8cda989b
2 changed files with 22 additions and 0 deletions
+10
View File
@@ -28,6 +28,16 @@ const htmlBeginning = `<!DOCTYPE html>
const htmlEnd = ` </main> const htmlEnd = ` </main>
</body> </body>
<script src="./dates.js"></script> <script src="./dates.js"></script>
<script>
var _cdnStyle = null;
window.addEventListener("beforeprint", function() {
_cdnStyle = document.getElementById("nhcarrigan-global-styles");
if (_cdnStyle) { _cdnStyle.remove(); }
});
window.addEventListener("afterprint", function() {
if (_cdnStyle) { document.head.appendChild(_cdnStyle); _cdnStyle = null; }
});
</script>
</html>`; </html>`;
const request = await fetch( const request = await fetch(
+12
View File
@@ -42,6 +42,9 @@ hr {
box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.7); box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.7);
margin-bottom: 10px; margin-bottom: 10px;
} }
footer {
z-index: 1;
}
} }
@media print { @media print {
:root { :root {
@@ -50,6 +53,15 @@ hr {
* { * {
color: black; color: black;
font-family: "Times New Roman", serif; font-family: "Times New Roman", serif;
margin: 0;
padding: 0;
}
h1 {
text-align: center;
font-size: 1.8rem;
}
.info {
text-align: center;
} }
video, video,
footer, footer,