X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fprinttofit.js;h=98236026ede661e3d43fb9441dce7bfee48100f6;hp=66257fca81c0fcd603f506c9e6c0f58aac267261;hb=66eb3662102dbf92ac40fb8889c9c5051fd1ed29;hpb=408574c3f92b84f422f9a95dd0ab904d9c23ece6 diff --git a/httemplate/elements/printtofit.js b/httemplate/elements/printtofit.js index 66257fca8..98236026e 100644 --- a/httemplate/elements/printtofit.js +++ b/httemplate/elements/printtofit.js @@ -1,13 +1,30 @@ $().ready(function() { + // yuck + var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor); var beforePrint = function() { if ($('body').width() > 0) { // 7.5 inches * 96 DPI; maybe make the width a user pref? var maxwidth = 7.5 * 96; $('body').css('zoom', maxwidth / $('body').width()); + if (isChrome) { + // Chrome doesn't respect page-break-* styles on table rows/cells, + // so wrap the contents of table cells with a block element + // ref. Chromium bug #99124, #87828, #59193 + // should be fixed with Chrome 53 + var nosplits = $('.nosplitrows td'); + if (nosplits.length > 0) { + nosplits.wrapInner('
'); + } + } } }; var afterPrint = function() { $('body').css('zoom', 1); + // get the direct children of the wrapper divs. + var nosplits = $('div.autowrap >'); + if (nosplits.length > 0) { + nosplits.unwrap(); + } } if (window.matchMedia) { // chrome, most importantly; also IE10?