-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge in changes from master that include fix for failing tests
- Loading branch information
Showing
28 changed files
with
462 additions
and
115 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
.hx-print-only { | ||
display: none; | ||
} | ||
|
||
@media print { | ||
/* Fix layout and font size issues with root elements */ | ||
html, | ||
body { | ||
height: auto; | ||
font-size: 12pt; | ||
page-break-after: avoid; | ||
} | ||
|
||
/* Force body to display in print-friendly mode */ | ||
body { | ||
background: transparent !important; | ||
width: 100% !important; | ||
padding: 0 !important; | ||
margin: 0 !important; | ||
color: black !important; | ||
} | ||
|
||
/* Hide elements that should not be shown when printing */ | ||
.hx-no-print, | ||
.hx-spinner, | ||
.hx-spinner-wide, | ||
.hx-heading, | ||
.hx-sidebar { | ||
display: none !important; | ||
} | ||
|
||
/* Box shadows display badly when printing */ | ||
* { | ||
box-shadow: none !important; | ||
} | ||
|
||
.hx-print-only { | ||
display: initial; | ||
} | ||
|
||
.hx-footnote-ref { | ||
font-size: 0.8em; | ||
margin-top: -0.5em; | ||
display: inline-block; | ||
font-style: italic; | ||
} | ||
|
||
/* Attempt prevention of page breaks inside important elements */ | ||
h1, h2, h3, h4, h5, h6, | ||
table, | ||
ul, | ||
svg, | ||
img, | ||
form, | ||
input, | ||
.hx-footnote-links, | ||
.hx-data-table, | ||
.hx-card, | ||
.hx-form, | ||
.hx-table, | ||
.hx-graph, | ||
.hx-meter { | ||
page-break-inside: avoid; | ||
} | ||
|
||
/* Attempt prevention of page breaks after heading elements */ | ||
h1, h2, h3, h4, h5, h6, | ||
.hx-footnote-links { | ||
page-break-after: avoid; | ||
} | ||
|
||
/* Reset font sizes for print (relative to 12pt) */ | ||
h1 { | ||
font-size: 250%; | ||
} | ||
|
||
h2 { | ||
font-size: 175%; | ||
} | ||
|
||
h3 { | ||
font-size: 135%; | ||
} | ||
|
||
h4 { | ||
font-size: 100%; | ||
font-variant: small-caps; | ||
} | ||
|
||
h5 { | ||
font-size: 100%; | ||
} | ||
|
||
h6 { | ||
font-size: 90%; | ||
font-style: italic; | ||
} | ||
|
||
/* Prevent images flowing outside the printable area */ | ||
img { | ||
max-width: 100% !important; | ||
} | ||
|
||
/* Remove the margin around content as this is handled by the print margin */ | ||
.hx-content { | ||
padding: 0 !important; | ||
margin: 0 !important; | ||
width: 100% !important; | ||
} | ||
|
||
/* Style links to be bold so they are visible as links */ | ||
a:link:not(.hx-btn), | ||
a:visited:not(.hx-btn) { | ||
font-weight: bolder; | ||
text-decoration: underline; | ||
} | ||
|
||
/* Set the page margin */ | ||
@page { | ||
margin: 1.5cm; | ||
} | ||
} | ||
|
||
/* Make most browsers show background colors etc. by default when printing */ | ||
@media print and (color) { | ||
* { | ||
-webkit-print-color-adjust: exact; | ||
print-color-adjust: exact; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
;(function () { | ||
function beforePrint () { | ||
var links = hx.detached('ol') | ||
var refs = [] | ||
hx.select('body').selectAll('*').forEach(function (sel) { | ||
if (sel.node().nodeName === 'A' && !sel.classed('.hx-btn')) { | ||
var thisRef = sel.attr('href') | ||
if (thisRef && thisRef.length && thisRef !== '#') { | ||
if (!(refs.indexOf(thisRef) > -1)) | ||
refs.push(thisRef) | ||
var itemIndex = refs.indexOf(thisRef) | ||
sel.add(hx.detached('sup')['class']('hx-footnote-ref hx-print-only').text('[' + (itemIndex + 1) + ']')) | ||
} | ||
} | ||
}) | ||
refs.forEach(function (ref) { | ||
links.add(hx.detached('li').text(ref)) | ||
}) | ||
if (refs.length > 0) { | ||
hx.select('body').add(hx.detached('div')['class']('hx-footnote-links hx-print-only').add('hr').add(hx.detached('h2').text('Links')).add(links)) | ||
} | ||
} | ||
|
||
function afterPrint () { | ||
hx.selectAll('.hx-footnote-ref').remove() | ||
hx.selectAll('.hx-footnote-links').remove() | ||
} | ||
|
||
if (window.matchMedia) { | ||
var mediaQueryList = window.matchMedia('print') | ||
mediaQueryList.addListener(function (mql) { | ||
if (mql.matches) { | ||
beforePrint() | ||
} else { | ||
afterPrint() | ||
} | ||
}) | ||
} | ||
|
||
window.onbeforeprint = beforePrint | ||
window.onafterprint = afterPrint | ||
}).call(this) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.