diff --git a/bookmarklet.js b/bookmarklet.js index 3042471..7e6a198 100644 --- a/bookmarklet.js +++ b/bookmarklet.js @@ -1,5 +1,5 @@ (function() { - var version = "4.1.1"; + var version = "4.2.0"; console.log("Version: " + version); var global = {}; @@ -310,27 +310,13 @@ var cardCount = jQuery(".card", printDocument).length; var pageCount = Math.ceil(cardCount / (columnCount * rowCount)) - // size - - // size horizontal - jQuery("#styleColumnCount", printDocument).remove(); - var style = document.createElement('style'); - style.id = 'styleColumnCount'; - style.type = 'text/css'; - style.innerHTML = ".card { width: calc( 100% / " + columnCount + " - 0.0001px ); }" - jQuery("head", printDocument).append(style); - - // size horizontal - jQuery("#styleRowCount", printDocument).remove(); - var style = document.createElement('style'); - style.id = 'styleRowCount'; - style.type = 'text/css'; - style.innerHTML = ".card { height: calc( 100% / " + rowCount + " - 0.0001px ); }" - jQuery("head", printDocument).append(style); - + // scale + // reset scale jQuery("html", printDocument).css("font-size", "1cm"); + jQuery("#styleColumnCount", printDocument).remove(); + jQuery("#styleRowCount", printDocument).remove(); // scale horizontal // substract one pixel due to rounding problems @@ -345,11 +331,27 @@ var cardMinHeight = jQuery(".card", printDocument).css("min-height").replace("px", ""); var scaleHeight = cardMaxHeight / cardMinHeight; - // scale min + // scale down var scale = Math.min(scaleWidth, scaleHeight, 1); if (scale < 1) { jQuery("html", printDocument).css("font-size", scale + "cm"); } + + // size + + // size horizontal + var style = document.createElement('style'); + style.id = 'styleColumnCount'; + style.type = 'text/css'; + style.innerHTML = ".card { width: calc( 100% / " + columnCount + " - 0.0001px ); }" + jQuery("head", printDocument).append(style); + + // size horizontal + var style = document.createElement('style'); + style.id = 'styleRowCount'; + style.type = 'text/css'; + style.innerHTML = ".card { height: calc( 100% / " + rowCount + " - 0.0001px ); }" + jQuery("head", printDocument).append(style); } function cropCards() { @@ -660,7 +662,7 @@ return result; } - // card layout: http://jsfiddle.net/qoomon/ykbLb2pw/ + // card layout: http://jsfiddle.net/qoomon/ykbLb2pw/76 function cardHtml(issueKey) { var page = jQuery(document.createElement('div')) @@ -668,31 +670,35 @@ .addClass("card") .html(multilineString(function() { /*! -