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);
|
console.log("Version: " + version);
|
||||||
|
|
||||||
var isDev = typeof isDev !== 'undefined' && isDev ;
|
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/";
|
var hostOrigin = "https://qoomon.github.io/Jira-Issue-Card-Printer/";
|
||||||
if(isDev){
|
if(isDev){
|
||||||
@ -75,6 +78,7 @@
|
|||||||
jQuery("#card-print-dialog-title").text("Card Print");
|
jQuery("#card-print-dialog-title").text("Card Print");
|
||||||
//print();
|
//print();
|
||||||
});
|
});
|
||||||
|
setColumnCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function print(){
|
function print(){
|
||||||
@ -102,14 +106,33 @@
|
|||||||
resizeIframe(printFrame);
|
resizeIframe(printFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
function endableMultiCardPage(enable){
|
function enableMultiCardPage(enable){
|
||||||
var printFrame = jQuery("#card-print-dialog-content-iframe");
|
var printFrame = jQuery("#card-print-dialog-content-iframe");
|
||||||
var printWindow = printFrame[0].contentWindow;
|
var printWindow = printFrame[0].contentWindow;
|
||||||
var printDocument = printWindow.document;
|
var printDocument = printWindow.document;
|
||||||
if(enable){
|
if(enable){
|
||||||
jQuery(".page", printDocument).addClass("multiCardPage");
|
jQuery(".page", printDocument).addClass("avoid-page-break");
|
||||||
} else {
|
} 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 = [];
|
var deferredList = [];
|
||||||
|
|
||||||
issueKeyList.each(function(position, issueKey) {
|
issueKeyList.each(function(index, issueKey) {
|
||||||
var page = newPage(issueKey);
|
var page = newPage(issueKey);
|
||||||
|
page.attr("index",index);
|
||||||
page.hide();
|
page.hide();
|
||||||
page.find('.key').text(issueKey);
|
page.find('.key').text(issueKey);
|
||||||
jQuery("body", printDocument).append(page);
|
jQuery("body", printDocument).append(page);
|
||||||
@ -284,7 +308,6 @@
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillCardWithJSONDataLRS(card, data) {
|
function fillCardWithJSONDataLRS(card, data) {
|
||||||
@ -358,9 +381,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="card-print-dialog-footer">
|
<div id="card-print-dialog-footer">
|
||||||
<div class="buttons">
|
<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="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="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" />
|
<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>
|
<a id="card-print-dialog-cancel" title="Cancel" class="cancel">Cancel</a>
|
||||||
</div>
|
</div>
|
||||||
@ -386,7 +410,15 @@
|
|||||||
|
|
||||||
result.find("#multi-card-page-checkbox")
|
result.find("#multi-card-page-checkbox")
|
||||||
.click(function() {
|
.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;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -556,7 +588,7 @@
|
|||||||
*/
|
*/
|
||||||
}));
|
}));
|
||||||
return result;
|
return result;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
function printPanelPageCSS(){
|
function printPanelPageCSS(){
|
||||||
@ -569,17 +601,37 @@
|
|||||||
HTML {
|
HTML {
|
||||||
font-size: 1.0cm;
|
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 {
|
.page {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
padding: 1.0cm;
|
padding: 0.5cm;
|
||||||
margin: 1.0cm;
|
margin-top: 0.5cm;
|
||||||
|
margin-bottom: 0.5cm;
|
||||||
width: auto;
|
width: auto;
|
||||||
height: auto;
|
height: auto;
|
||||||
page-break-after: always;
|
|
||||||
page-break-inside: avoid;
|
|
||||||
|
|
||||||
background:white;
|
background:white;
|
||||||
|
|
||||||
@ -593,23 +645,27 @@
|
|||||||
border-radius: 0.1cm;
|
border-radius: 0.1cm;
|
||||||
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.multiCardPage {
|
|
||||||
page-break-after: avoid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
|
|
||||||
.page {
|
body {
|
||||||
background: white;
|
|
||||||
border-style: none;
|
|
||||||
padding: 0.0cm;
|
padding: 0.0cm;
|
||||||
margin: 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;
|
-webkit-box-shadow: none;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
@ -618,14 +674,9 @@
|
|||||||
print-color-adjust: exact;
|
print-color-adjust: exact;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page:first-of-type {
|
.avoid-page-break {
|
||||||
margin-top: 0cm;
|
page-break-after: avoid;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page:last-of-type {
|
|
||||||
page-break-after: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}));
|
}));
|
||||||
@ -779,7 +830,6 @@
|
|||||||
}
|
}
|
||||||
.card-footer {
|
.card-footer {
|
||||||
position: relative;
|
position: relative;
|
||||||
page-break-inside: avoid;
|
|
||||||
}
|
}
|
||||||
.summary {
|
.summary {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user