add column view
known bug: page-break-after not working
This commit is contained in:
parent
bf1e3dda70
commit
05992ab72e
112
bookmarklet.js
112
bookmarklet.js
@ -3,6 +3,9 @@
|
||||
console.log("Version: " + version);
|
||||
|
||||
var isDev = typeof isDev !== 'undefined' && isDev ;
|
||||
if (/.*projectKey=ANERDS.*/g.test(document.URL)) {
|
||||
isDev = true;
|
||||
}
|
||||
|
||||
var hostOrigin = "https://qoomon.github.io/Jira-Issue-Card-Printer/";
|
||||
if(isDev){
|
||||
@ -75,6 +78,7 @@
|
||||
jQuery("#card-print-dialog-title").text("Card Print");
|
||||
//print();
|
||||
});
|
||||
setColumnCount(1);
|
||||
}
|
||||
|
||||
function print(){
|
||||
@ -102,14 +106,33 @@
|
||||
resizeIframe(printFrame);
|
||||
}
|
||||
|
||||
function endableMultiCardPage(enable){
|
||||
function enableMultiCardPage(enable){
|
||||
var printFrame = jQuery("#card-print-dialog-content-iframe");
|
||||
var printWindow = printFrame[0].contentWindow;
|
||||
var printDocument = printWindow.document;
|
||||
if(enable){
|
||||
jQuery(".page", printDocument).addClass("multiCardPage");
|
||||
jQuery(".page", printDocument).addClass("avoid-page-break");
|
||||
} else {
|
||||
jQuery(".page", printDocument).removeClass("multiCardPage");
|
||||
jQuery(".page", printDocument).removeClass("avoid-page-break");
|
||||
}
|
||||
}
|
||||
|
||||
function setColumnCount(columnCount){
|
||||
var printFrame = jQuery("#card-print-dialog-content-iframe");
|
||||
var printWindow = printFrame[0].contentWindow;
|
||||
var printDocument = printWindow.document;
|
||||
|
||||
jQuery(".column > .page",printDocument).unwrap();
|
||||
jQuery(".page",printDocument).sort(function(a, b) {
|
||||
return parseInt(jQuery(a).attr("index")) > parseInt(jQuery(b).attr("index")) ? 1 : -1;
|
||||
}).appendTo(jQuery("body",printDocument));
|
||||
|
||||
var columns = []
|
||||
for(var columnIndex = 0; columnIndex < columnCount; columnIndex+=1) {
|
||||
columns[columnIndex] = jQuery(".page:nth-child("+columnCount+"n+"+columnIndex+")", printDocument);
|
||||
}
|
||||
for(var columnIndex = 0; columnIndex < columnCount; columnIndex+=1) {
|
||||
columns[columnIndex].wrapAll("<div class='column' style='width: calc(100% / "+columnCount+" - "+((columnCount-1)/columnCount)+"cm)'></div>");
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,8 +152,9 @@
|
||||
|
||||
var deferredList = [];
|
||||
|
||||
issueKeyList.each(function(position, issueKey) {
|
||||
issueKeyList.each(function(index, issueKey) {
|
||||
var page = newPage(issueKey);
|
||||
page.attr("index",index);
|
||||
page.hide();
|
||||
page.find('.key').text(issueKey);
|
||||
jQuery("body", printDocument).append(page);
|
||||
@ -284,7 +308,6 @@
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function fillCardWithJSONDataLRS(card, data) {
|
||||
@ -358,9 +381,10 @@
|
||||
</div>
|
||||
<div id="card-print-dialog-footer">
|
||||
<div class="buttons">
|
||||
<label style="margin-right:10px"><input id="card-scale-range" type="range" min="0.2" max="1.6" step="0.1" value="1.0" />Scale</label>
|
||||
<label style="margin-right:10px"><input id="card-scale-range" type="range" min="0.4" max="1.4" step="0.05" value="1.0" />Scale</label>
|
||||
<label style="margin-right:10px"><input id="hide-description-checkbox" type="checkbox"/>Hide Description</label>
|
||||
<label style="margin-right:10px"><input id="multi-card-page-checkbox" type="checkbox"/>Multi Card Page</label>
|
||||
<label style="margin-right:10px"><input id="two-column-page-checkbox" type="checkbox"/>Two Column Page</label>
|
||||
<input id="card-print-dialog-print" type="button" class="aui-button aui-button-primary" value="Print" />
|
||||
<a id="card-print-dialog-cancel" title="Cancel" class="cancel">Cancel</a>
|
||||
</div>
|
||||
@ -386,7 +410,15 @@
|
||||
|
||||
result.find("#multi-card-page-checkbox")
|
||||
.click(function() {
|
||||
endableMultiCardPage(this.checked);
|
||||
enableMultiCardPage(this.checked);
|
||||
return true;
|
||||
});
|
||||
|
||||
// enable two column page
|
||||
|
||||
result.find("#two-column-page-checkbox")
|
||||
.click(function() {
|
||||
setColumnCount(this.checked ? 2 : 1);
|
||||
return true;
|
||||
});
|
||||
|
||||
@ -556,7 +588,7 @@
|
||||
*/
|
||||
}));
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function printPanelPageCSS(){
|
||||
@ -569,17 +601,37 @@
|
||||
HTML {
|
||||
font-size: 1.0cm;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 0.5cm;
|
||||
}
|
||||
|
||||
.column{
|
||||
display:inline-block;
|
||||
float: left;
|
||||
padding: 0.0cm;
|
||||
margin: 0.0cm;
|
||||
margin-right: 0.5cm;
|
||||
margin-left: 0.5cm;
|
||||
}
|
||||
|
||||
.column:first-of-type{
|
||||
margin-left: 0.0cm;
|
||||
}
|
||||
.column:last-of-type {
|
||||
margin-right: 0.0cm;
|
||||
}
|
||||
|
||||
.page {
|
||||
position: relative;
|
||||
overflow: auto;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding: 1.0cm;
|
||||
margin: 1.0cm;
|
||||
padding: 0.5cm;
|
||||
margin-top: 0.5cm;
|
||||
margin-bottom: 0.5cm;
|
||||
width: auto;
|
||||
height: auto;
|
||||
page-break-after: always;
|
||||
page-break-inside: avoid;
|
||||
|
||||
background:white;
|
||||
|
||||
@ -593,23 +645,27 @@
|
||||
border-radius: 0.1cm;
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
}
|
||||
|
||||
.multiCardPage {
|
||||
page-break-after: avoid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@media print {
|
||||
|
||||
.page {
|
||||
background: white;
|
||||
border-style: none;
|
||||
body {
|
||||
padding: 0.0cm;
|
||||
margin: 0.0cm;
|
||||
margin-top: 1.0cm;
|
||||
|
||||
}
|
||||
|
||||
.page {
|
||||
background: white;
|
||||
padding: 0.0cm;
|
||||
margin: 0.0cm;
|
||||
margin-bottom: 1.0cm;
|
||||
|
||||
page-break-after: always;
|
||||
page-break-inside: avoid;
|
||||
|
||||
background: white;
|
||||
border-style: none;
|
||||
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
@ -618,14 +674,9 @@
|
||||
print-color-adjust: exact;
|
||||
}
|
||||
|
||||
.page:first-of-type {
|
||||
margin-top: 0cm;
|
||||
.avoid-page-break {
|
||||
page-break-after: avoid;
|
||||
}
|
||||
|
||||
.page:last-of-type {
|
||||
page-break-after: auto;
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
}));
|
||||
@ -779,7 +830,6 @@
|
||||
}
|
||||
.card-footer {
|
||||
position: relative;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
.summary {
|
||||
font-weight: bold;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user