+ hide assignee
+ hide due date
This commit is contained in:
parent
d29739acef
commit
c7fcc2767b
124
bookmarklet.js
124
bookmarklet.js
@ -69,14 +69,21 @@
|
||||
|
||||
var printFrame = jQuery("#card-print-dialog-content-iframe");
|
||||
var printWindow = printFrame[0].contentWindow;
|
||||
printWindow.addEventListener("resize", function(){redrawCards();});
|
||||
printWindow.matchMedia("print").addListener(function(){redrawCards();});
|
||||
printWindow.addEventListener("resize", function() {
|
||||
redrawCards();
|
||||
});
|
||||
printWindow.matchMedia("print").addListener(function() {
|
||||
redrawCards();
|
||||
});
|
||||
|
||||
jQuery("#rowCount").val(readCookie("card_printer_row_count", 2));
|
||||
jQuery("#columnCount").val(readCookie("card_printer_column_count", 1));
|
||||
//jQuery("#font-scale-range").val(readCookie("card_printer_font_scale",1));
|
||||
jQuery("#single-card-page-checkbox").attr('checked', readCookie("card_printer_single_card_page", 'true') == 'true');
|
||||
jQuery("#hide-description-checkbox").attr('checked', readCookie("card_printer_hide_description", 'false') == 'true');
|
||||
jQuery("#hide-assignee-checkbox").attr('checked', readCookie("card_printer_hide_assignee", 'true') == 'true');
|
||||
jQuery("#hide-due-date-checkbox").attr('checked', readCookie("card_printer_hide_due_date", 'false') == 'true');
|
||||
jQuery("#hide-status-checkbox").attr('checked', readCookie("card_printer_hide_status", 'true') == 'true');
|
||||
|
||||
jQuery("#card-print-dialog-title").text("Card Print - Loading " + issueKeyList.length + " issues...");
|
||||
renderCards(issueKeyList, function() {
|
||||
@ -166,36 +173,13 @@
|
||||
|
||||
function redrawCards() {
|
||||
|
||||
var printFrame = jQuery("#card-print-dialog-content-iframe");
|
||||
var printWindow = printFrame[0].contentWindow;
|
||||
var printDocument = printWindow.document;
|
||||
|
||||
// hide/show description
|
||||
jQuery("#styleHideDescription", printDocument).remove();
|
||||
if(jQuery("#hide-description-checkbox")[0].checked){
|
||||
var style= document.createElement('style');
|
||||
style.id = 'styleHideDescription';
|
||||
style.type ='text/css';
|
||||
style.innerHTML = ".issue-description { display: none; }"
|
||||
jQuery("head", printDocument).append(style);
|
||||
}
|
||||
|
||||
// enable/disable single card page
|
||||
jQuery("#styleSingleCardPage", printDocument).remove();
|
||||
if(jQuery("#single-card-page-checkbox")[0].checked){
|
||||
var style= document.createElement('style');
|
||||
style.id = 'styleSingleCardPage';
|
||||
style.type ='text/css';
|
||||
style.innerHTML = ".card { page-break-after: always; float: none; }"
|
||||
jQuery("head", printDocument).append(style);
|
||||
}
|
||||
styleCards();
|
||||
|
||||
scaleCards();
|
||||
|
||||
cropCards();
|
||||
|
||||
var printFrame = jQuery("#card-print-dialog-content-iframe");
|
||||
resizeIframe(printFrame);
|
||||
resizeIframe(jQuery("#card-print-dialog-content-iframe"));
|
||||
}
|
||||
|
||||
|
||||
@ -259,6 +243,62 @@
|
||||
card.find(".issue-qr-code").css("background-image", "url('" + qrCodeUrl + "')");
|
||||
}
|
||||
|
||||
function styleCards() {
|
||||
var printFrame = jQuery("#card-print-dialog-content-iframe");
|
||||
var printWindow = printFrame[0].contentWindow;
|
||||
var printDocument = printWindow.document;
|
||||
|
||||
// hide/show description
|
||||
jQuery("#styleHideDescription", printDocument).remove();
|
||||
if (jQuery("#hide-description-checkbox")[0].checked) {
|
||||
var style = document.createElement('style');
|
||||
style.id = 'styleHideDescription';
|
||||
style.type = 'text/css';
|
||||
style.innerHTML = ".issue-description { display: none; }"
|
||||
jQuery("head", printDocument).append(style);
|
||||
}
|
||||
|
||||
// hide/show assignee
|
||||
jQuery("#styleHideAssignee", printDocument).remove();
|
||||
if (jQuery("#hide-assignee-checkbox")[0].checked) {
|
||||
var style = document.createElement('style');
|
||||
style.id = 'styleHideAssignee';
|
||||
style.type = 'text/css';
|
||||
style.innerHTML = ".issue-assignee { display: none; }"
|
||||
jQuery("head", printDocument).append(style);
|
||||
}
|
||||
|
||||
// hide/show assignee
|
||||
jQuery("#styleHideDueDate", printDocument).remove();
|
||||
if (jQuery("#hide-due-date-checkbox")[0].checked) {
|
||||
var style = document.createElement('style');
|
||||
style.id = 'styleHideDueDate';
|
||||
style.type = 'text/css';
|
||||
style.innerHTML = ".issue-due-box { display: none; }"
|
||||
jQuery("head", printDocument).append(style);
|
||||
}
|
||||
|
||||
// hide/show status
|
||||
jQuery("#styleHideStatus", printDocument).remove();
|
||||
if (!jQuery("#hide-status-checkbox")[0].checked) {
|
||||
var style = document.createElement('style');
|
||||
style.id = 'styleHideStatus';
|
||||
style.type = 'text/css';
|
||||
style.innerHTML = ".issue-status { display: none; }"
|
||||
jQuery("head", printDocument).append(style);
|
||||
}
|
||||
|
||||
// enable/disable single card page
|
||||
jQuery("#styleSingleCardPage", printDocument).remove();
|
||||
if (jQuery("#single-card-page-checkbox")[0].checked) {
|
||||
var style = document.createElement('style');
|
||||
style.id = 'styleSingleCardPage';
|
||||
style.type = 'text/css';
|
||||
style.innerHTML = ".card { page-break-after: always; float: none; }"
|
||||
jQuery("head", printDocument).append(style);
|
||||
}
|
||||
}
|
||||
|
||||
function scaleCards() {
|
||||
var printFrame = jQuery("#card-print-dialog-content-iframe");
|
||||
var printWindow = printFrame[0].contentWindow;
|
||||
@ -367,8 +407,11 @@
|
||||
<label style="display:none; margin-right:10px"><input id="font-scale-range" type="range" min="0.4" max="1.6" step="0.1" value="1.0" />Font Scale</label>
|
||||
<label style="margin-right:10px;"><input id="rowCount" type="text" class="text" maxlength="1" style="width: 10px;" value="2"/>Row Count</label>
|
||||
<label style="margin-right:10px;"><input id="columnCount" type="text" class="text" maxlength="1" style="width: 10px;" value="1"/>Column Count</label>
|
||||
<label style="margin-right:10px"><input id="single-card-page-checkbox" type="checkbox"/>Single Card Page</label>
|
||||
<label style="margin-right:10px"><input id="single-card-page-checkbox" type="checkbox"/>Single Card Per Page</label>
|
||||
<label style="margin-right:10px"><input id="hide-description-checkbox" type="checkbox"/>Hide Description</label>
|
||||
<label style="margin-right:10px"><input id="hide-assignee-checkbox" type="checkbox"/>Hide Assignee</label>
|
||||
<label style="margin-right:10px"><input id="hide-due-date-checkbox" type="checkbox"/>Hide Due Date</label>
|
||||
<label style="display:none; margin-right:10px"><input id="hide-status-checkbox" type="checkbox"/>Hide Status</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>
|
||||
@ -404,6 +447,30 @@
|
||||
return true;
|
||||
});
|
||||
|
||||
// show assignee
|
||||
|
||||
result.find("#hide-assignee-checkbox").click(function() {
|
||||
writeCookie("card_printer_hide_assignee", this.checked);
|
||||
redrawCards();
|
||||
return true;
|
||||
});
|
||||
|
||||
// show due date
|
||||
|
||||
result.find("#hide-due-date-checkbox").click(function() {
|
||||
writeCookie("card_printer_hide_due_date", this.checked);
|
||||
redrawCards();
|
||||
return true;
|
||||
});
|
||||
|
||||
// show status
|
||||
|
||||
result.find("#hide-status-checkbox").click(function() {
|
||||
writeCookie("card_printer_hide_status", this.checked);
|
||||
redrawCards();
|
||||
return true;
|
||||
});
|
||||
|
||||
// scale font
|
||||
|
||||
result.find("#font-scale-range").on("input", function() {
|
||||
@ -998,6 +1065,7 @@
|
||||
}
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
function writeCookie(name, value) {
|
||||
document.cookie = name + "=" + value;
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
Loading…
x
Reference in New Issue
Block a user