2015-05-15 16:27:35 +02:00
|
|
|
(function() {
|
2015-11-27 11:35:07 +01:00
|
|
|
// Public Instances
|
|
|
|
|
// Jira: https://connect.atlassian.net/browse/NERDS-33286
|
|
|
|
|
// PivotTracker: https://www.pivotaltracker.com/n/projects/510733
|
|
|
|
|
// Trello: https://trello.com/b/8zlPSh70/spike
|
|
|
|
|
// YouTrack: http://qoomon.myjetbrains.com/youtrack/dashboard
|
2016-08-29 16:38:01 +02:00
|
|
|
|
2016-06-03 12:51:53 +02:00
|
|
|
if (!String.prototype.startsWith) {
|
|
|
|
|
String.prototype.startsWith = function(searchString, position) {
|
|
|
|
|
position = position || 0;
|
|
|
|
|
return this.indexOf(searchString, position) === position;
|
|
|
|
|
};
|
|
|
|
|
}
|
2015-12-28 16:42:54 +01:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
var global = {};
|
2016-08-25 15:51:13 +02:00
|
|
|
global.version = "4.7.4";
|
2016-08-30 11:26:22 +02:00
|
|
|
global.issueTrackingUrl = "static.ragnarok.yvan.hu/jira-card-printer";
|
2015-12-28 16:42:54 +01:00
|
|
|
|
2015-11-25 08:51:24 +01:00
|
|
|
global.isDev = document.currentScript == null;
|
2015-06-07 13:39:29 +02:00
|
|
|
|
2016-06-03 12:51:53 +02:00
|
|
|
var $ = jQuery;
|
|
|
|
|
|
2015-12-28 16:42:54 +01:00
|
|
|
// enforce jQuery
|
2015-12-28 15:31:31 +01:00
|
|
|
if (typeof jQuery == 'undefined') {
|
2016-04-21 11:47:57 +02:00
|
|
|
alert("jQuery is required!\n\nPlease create an issue at\n" + global.issueTrackingUrl);
|
2015-12-28 15:31:31 +01:00
|
|
|
return;
|
|
|
|
|
}
|
2016-08-29 16:38:01 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
|
2015-12-28 16:42:54 +01:00
|
|
|
// run
|
2015-12-28 15:31:31 +01:00
|
|
|
try {
|
|
|
|
|
init().then(main).catch(handleError);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
handleError(e);
|
|
|
|
|
}
|
2015-06-07 13:39:29 +02:00
|
|
|
|
|
|
|
|
function main() {
|
2015-12-28 15:31:31 +01:00
|
|
|
var promises = [];
|
|
|
|
|
|
2016-08-30 11:26:22 +02:00
|
|
|
// ga('send', 'pageview');
|
2015-12-28 15:31:31 +01:00
|
|
|
|
2015-12-27 22:51:13 +01:00
|
|
|
//preconditions
|
|
|
|
|
if ($("#card-printer-iframe").length > 0) {
|
2016-01-06 08:49:35 +01:00
|
|
|
closePrintPreview();
|
2015-12-27 22:51:13 +01:00
|
|
|
}
|
|
|
|
|
|
2015-11-25 08:45:13 +01:00
|
|
|
console.log("Run...")
|
2015-12-29 11:50:41 +01:00
|
|
|
for (issueTracker of getIssueTrackers()) {
|
|
|
|
|
if(issueTracker.isEligible()){
|
2016-04-21 12:31:38 +02:00
|
|
|
console.log("Issue Tracker: " + issueTracker.name);
|
2015-12-29 11:50:41 +01:00
|
|
|
global.appFunctions = issueTracker;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!global.appFunctions){
|
2015-11-25 12:17:08 +01:00
|
|
|
alert("Unsupported app. Please create an issue at " + global.issueTrackingUrl);
|
2015-06-07 13:39:29 +02:00
|
|
|
return;
|
2015-05-12 12:04:40 +02:00
|
|
|
}
|
|
|
|
|
|
2015-12-28 15:31:31 +01:00
|
|
|
// add overlay frame
|
|
|
|
|
var appFrame = createOverlayFrame();
|
2015-12-27 22:51:13 +01:00
|
|
|
$("body").append(appFrame);
|
2016-04-21 12:31:38 +02:00
|
|
|
|
|
|
|
|
|
2015-12-28 15:31:31 +01:00
|
|
|
// add convinient fields
|
2015-12-16 18:21:30 +01:00
|
|
|
appFrame.window = appFrame.contentWindow;
|
|
|
|
|
appFrame.document = appFrame.window.document;
|
2016-02-16 15:42:40 +01:00
|
|
|
appFrame.document.open();
|
|
|
|
|
appFrame.document.close();
|
2015-12-16 18:21:30 +01:00
|
|
|
global.appFrame = appFrame;
|
|
|
|
|
|
2015-12-28 15:31:31 +01:00
|
|
|
// add print dialog content
|
|
|
|
|
$("head", global.appFrame.document).prepend(printPreviewElementStyle());
|
|
|
|
|
$("body", global.appFrame.document).append(printPreviewElement());
|
|
|
|
|
updatePrintDialoge();
|
2015-12-16 18:21:30 +01:00
|
|
|
|
2015-12-28 15:31:31 +01:00
|
|
|
// get print content frame
|
|
|
|
|
var printFrame = $("#card-print-dialog-content-iframe", global.appFrame.document)[0];
|
|
|
|
|
// add convinient fields
|
2015-12-16 18:21:30 +01:00
|
|
|
printFrame.window = printFrame.contentWindow;
|
|
|
|
|
printFrame.document = printFrame.window.document;
|
2016-02-16 15:42:40 +01:00
|
|
|
printFrame.document.open();
|
|
|
|
|
printFrame.document.close();
|
2015-12-16 18:21:30 +01:00
|
|
|
global.printFrame = printFrame;
|
|
|
|
|
|
2015-12-28 15:31:31 +01:00
|
|
|
// add listeners to redraw crads on print event
|
|
|
|
|
printFrame.window.addEventListener("resize", redrawCards);
|
|
|
|
|
printFrame.window.matchMedia("print").addListener(redrawCards);
|
2015-04-18 01:34:10 +02:00
|
|
|
|
2015-12-28 17:16:02 +01:00
|
|
|
// collect selcted issues
|
|
|
|
|
var issueKeyList = global.appFunctions.getSelectedIssueKeyList();
|
|
|
|
|
if (issueKeyList.length <= 0) {
|
|
|
|
|
alert("Please select at least one issue.");
|
|
|
|
|
return;
|
|
|
|
|
} else if (issueKeyList.length > 30) {
|
|
|
|
|
var confirmResult = confirm("Are you sure you want select " + issueKeyList.length + " issues?");
|
|
|
|
|
if (!confirmResult) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-28 16:42:54 +01:00
|
|
|
// render cards
|
|
|
|
|
promises.push(renderCards(issueKeyList));
|
|
|
|
|
|
2015-12-28 15:31:31 +01:00
|
|
|
$("#card-print-dialog-title", global.appFrame.document).text("Card Printer " + global.version + " - Loading issues...");
|
2015-12-28 16:42:54 +01:00
|
|
|
return Promise.all(promises).then(function() {
|
2015-12-28 15:31:31 +01:00
|
|
|
$("#card-print-dialog-title", global.appFrame.document).text("Card Printer " + global.version);
|
2015-12-28 16:42:54 +01:00
|
|
|
});
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
2015-06-01 16:20:12 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
function init() {
|
2015-11-25 12:01:42 +01:00
|
|
|
var promises = [];
|
|
|
|
|
|
2015-11-25 08:45:13 +01:00
|
|
|
console.log("Init...")
|
2016-08-30 11:26:22 +02:00
|
|
|
// initGoogleAnalytics();
|
2015-06-01 16:20:12 +02:00
|
|
|
|
2015-12-28 15:31:31 +01:00
|
|
|
addStringFunctions();
|
2015-11-27 14:06:46 +01:00
|
|
|
loadSettings();
|
|
|
|
|
|
2016-08-30 11:26:22 +02:00
|
|
|
global.hostOrigin = "https://static.ragnarok.yvan.hu/jira-card-printer/";
|
2016-08-29 16:38:01 +02:00
|
|
|
// if (global.isDev) {
|
|
|
|
|
// console.log("DEVELOPMENT");
|
|
|
|
|
// global.hostOrigin = "https://rawgit.com/qoomon/Jira-Issue-Card-Printer/develop/";
|
|
|
|
|
// }
|
2015-06-07 13:39:29 +02:00
|
|
|
global.resourceOrigin = global.hostOrigin + "resources/";
|
2015-05-12 12:04:40 +02:00
|
|
|
|
2015-12-29 11:50:41 +01:00
|
|
|
var resources = getResources();
|
2015-11-25 12:56:03 +01:00
|
|
|
|
2015-12-29 11:50:41 +01:00
|
|
|
global.cardHtml = resources.cardHtml;
|
2016-08-30 11:26:22 +02:00
|
|
|
global.cardCss = resources.cardCss.replace(/https:\/\/static.ragnarok.yvan.hu\/jira-card-printer\/resources/g, global.resourceOrigin);
|
2015-12-29 11:50:41 +01:00
|
|
|
global.printPreviewHtml = resources.printPreviewHtml;
|
2016-08-30 11:26:22 +02:00
|
|
|
global.printPreviewCss = resources.printPreviewCss.replace(/https:\/\/static.ragnarok.yvan.hu\/jira-card-printer\/resources/g, global.resourceOrigin);
|
2015-11-25 12:56:03 +01:00
|
|
|
|
2015-11-25 08:45:13 +01:00
|
|
|
return Promise.all(promises);
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
2015-06-03 08:36:28 +02:00
|
|
|
|
2016-04-21 11:47:57 +02:00
|
|
|
function error2object(value) {
|
|
|
|
|
if (value instanceof Error) {
|
|
|
|
|
var error = {};
|
|
|
|
|
Object.getOwnPropertyNames(value).forEach(function (key) {
|
|
|
|
|
error[key] = value[key];
|
|
|
|
|
});
|
|
|
|
|
return error;
|
|
|
|
|
}
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-28 15:31:31 +01:00
|
|
|
function handleError(error){
|
2016-04-21 11:47:57 +02:00
|
|
|
error = error2object(error);
|
|
|
|
|
var error = JSON.stringify(error,2,2);
|
|
|
|
|
console.log("ERROR " + error);
|
2016-08-30 13:41:17 +02:00
|
|
|
// ga('send', 'exception', { 'exDescription': error, 'exFatal': true });
|
2016-04-21 11:47:57 +02:00
|
|
|
alert("Sorry something went wrong\n\nPlease create an issue with following details at\n" + global.issueTrackingUrl + "\n\n" + error);
|
2015-12-28 15:31:31 +01:00
|
|
|
}
|
|
|
|
|
|
2015-11-27 14:06:46 +01:00
|
|
|
function saveSettings(){
|
|
|
|
|
var settings = global.settings;
|
2015-11-30 13:26:37 +01:00
|
|
|
writeCookie("card_printer_scale", settings.scale);
|
|
|
|
|
writeCookie("card_printer_row_count", settings.rowCount);
|
|
|
|
|
writeCookie("card_printer_column_count", settings.colCount);
|
|
|
|
|
|
2015-11-27 14:06:46 +01:00
|
|
|
writeCookie("card_printer_single_card_page", settings.singleCardPage);
|
|
|
|
|
writeCookie("card_printer_hide_description", settings.hideDescription);
|
|
|
|
|
writeCookie("card_printer_hide_assignee", settings.hideAssignee);
|
|
|
|
|
writeCookie("card_printer_hide_due_date", settings.hideDueDate);
|
2016-05-23 09:19:34 +02:00
|
|
|
writeCookie("card_printer_hide_estimate", settings.hideEstimate);
|
2015-12-10 14:15:05 +01:00
|
|
|
writeCookie("card_printer_hide_qr_code", settings.hideQrCode);
|
2015-11-27 14:06:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function loadSettings(){
|
|
|
|
|
var settings = global.settings = global.settings || {};
|
2015-11-30 17:06:49 +01:00
|
|
|
settings.scale = parseFloat(readCookie("card_printer_scale")) || 0.0;
|
2015-12-28 15:31:31 +01:00
|
|
|
settings.rowCount = parseInt(readCookie("card_printer_row_count")) || 2;
|
2015-11-27 15:02:05 +01:00
|
|
|
settings.colCount = parseInt(readCookie("card_printer_column_count")) || 1;
|
|
|
|
|
|
|
|
|
|
settings.singleCardPage = parseBool(readCookie("card_printer_single_card_page"), true );
|
|
|
|
|
settings.hideDescription = parseBool(readCookie("card_printer_hide_description"), false);
|
|
|
|
|
settings.hideAssignee = parseBool(readCookie("card_printer_hide_assignee"), false);
|
|
|
|
|
settings.hideDueDate = parseBool(readCookie("card_printer_hide_due_date"), false);
|
2016-05-23 09:19:34 +02:00
|
|
|
settings.hideEstimate = parseBool(readCookie("card_printer_hide_estimate"), false);
|
2015-12-10 14:15:05 +01:00
|
|
|
settings.hideQrCode = parseBool(readCookie("card_printer_hide_qr_code"), false);
|
2015-11-27 14:06:46 +01:00
|
|
|
}
|
|
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
function print() {
|
2016-08-30 13:41:17 +02:00
|
|
|
// ga('send', 'event', 'button', 'click', 'print', $(".card", global.printFrame.contentWindow.document).length);
|
2015-12-16 18:21:30 +01:00
|
|
|
global.printFrame.contentWindow.print();
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
2015-05-12 13:19:43 +02:00
|
|
|
|
2015-12-28 15:31:31 +01:00
|
|
|
function createOverlayFrame(){
|
|
|
|
|
var appFrame = document.createElement('iframe');
|
|
|
|
|
appFrame.id = "card-printer-iframe";
|
|
|
|
|
$(appFrame).css({
|
|
|
|
|
'position': 'fixed',
|
|
|
|
|
'height': '100%',
|
|
|
|
|
'width': '100%',
|
|
|
|
|
'top': '0',
|
|
|
|
|
'left': '0',
|
2015-12-28 17:26:13 +01:00
|
|
|
'background': 'rgba(0, 0, 0, 0.0)',
|
2015-12-28 15:31:31 +01:00
|
|
|
'boxSizing': 'border-box',
|
|
|
|
|
'wordWrap': 'break-word',
|
|
|
|
|
'zIndex': '99999'
|
|
|
|
|
});
|
|
|
|
|
return appFrame;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function updatePrintDialoge(){
|
|
|
|
|
var appFrameDocument = global.appFrame.document;
|
|
|
|
|
var settings = global.settings;
|
|
|
|
|
$("#scaleRange", appFrameDocument).val(settings.scale);
|
|
|
|
|
$("#scaleRange", appFrameDocument).parent().find("output").val(settings.scale);
|
|
|
|
|
$("#rowCount", appFrameDocument).val(settings.rowCount);
|
|
|
|
|
$("#columnCount", appFrameDocument).val(settings.colCount);
|
|
|
|
|
|
|
|
|
|
$("#single-card-page-checkbox", appFrameDocument).attr('checked', settings.singleCardPage );
|
|
|
|
|
$("#description-checkbox", appFrameDocument).attr('checked', !settings.hideDescription );
|
|
|
|
|
$("#assignee-checkbox", appFrameDocument).attr('checked', !settings.hideAssignee );
|
|
|
|
|
$("#due-date-checkbox", appFrameDocument).attr('checked', !settings.hideDueDate );
|
2016-05-23 09:19:34 +02:00
|
|
|
$("#estimate-checkbox", appFrameDocument).attr('checked', !settings.hideEstimate );
|
2015-12-28 15:31:31 +01:00
|
|
|
$("#qr-code-checkbox", appFrameDocument).attr('checked', !settings.hideQrCode );
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-25 12:01:42 +01:00
|
|
|
function renderCards(issueKeyList) {
|
2015-11-25 12:56:03 +01:00
|
|
|
var promises = [];
|
2015-06-02 14:16:40 +02:00
|
|
|
|
2015-12-28 15:49:30 +01:00
|
|
|
var printFrameDocument = global.printFrame.document;
|
2015-06-02 14:16:40 +02:00
|
|
|
|
2015-12-28 15:49:30 +01:00
|
|
|
printFrameDocument.open();
|
|
|
|
|
printFrameDocument.write("<head/><body></body>");
|
2015-12-28 16:42:54 +01:00
|
|
|
printFrameDocument.close();
|
2015-06-02 14:16:40 +02:00
|
|
|
|
2015-12-28 15:49:30 +01:00
|
|
|
$("head", printFrameDocument).append(cardElementStyle());
|
|
|
|
|
$("body", printFrameDocument).append("<div id='preload'/>");
|
|
|
|
|
$("#preload", printFrameDocument).append("<div class='zigzag'/>");
|
2015-06-02 13:42:42 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
console.log("load " + issueKeyList.length + " issues...");
|
2015-06-02 13:42:42 +02:00
|
|
|
|
2015-12-27 22:51:13 +01:00
|
|
|
$.each(issueKeyList, function(index, issueKey) {
|
2015-11-25 08:45:13 +01:00
|
|
|
var card = cardElement(issueKey);
|
|
|
|
|
card.attr("index", index);
|
|
|
|
|
card.find('.issue-id').text(issueKey);
|
2015-12-28 15:49:30 +01:00
|
|
|
$("body", printFrameDocument).append(card);
|
2015-11-25 12:01:42 +01:00
|
|
|
|
|
|
|
|
promises.push(global.appFunctions.getCardData(issueKey).then(function(cardData) {
|
2016-04-21 11:47:57 +02:00
|
|
|
// console.log("cardData: " + JSON.stringify(cardData,2,2));
|
2016-08-30 13:41:17 +02:00
|
|
|
// ga('send', 'event', 'card', 'generate', cardData.type);
|
2015-11-25 08:45:13 +01:00
|
|
|
fillCard(card, cardData);
|
2015-06-07 13:39:29 +02:00
|
|
|
redrawCards();
|
2015-11-25 12:01:42 +01:00
|
|
|
}));
|
2015-06-07 13:39:29 +02:00
|
|
|
});
|
|
|
|
|
|
2015-11-25 12:56:03 +01:00
|
|
|
console.log("wait for issues loaded...");
|
2015-11-25 12:01:42 +01:00
|
|
|
return Promise.all(promises).then(function() {
|
2015-06-07 13:39:29 +02:00
|
|
|
console.log("...all issues loaded.");
|
2015-12-11 11:30:09 +01:00
|
|
|
redrawCards();
|
2015-11-27 07:52:48 +01:00
|
|
|
});
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
2015-06-02 13:42:42 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
function redrawCards() {
|
|
|
|
|
styleCards();
|
|
|
|
|
scaleCards();
|
|
|
|
|
cropCards();
|
2015-12-16 18:21:30 +01:00
|
|
|
resizeIframe(global.printFrame);
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
2015-05-12 11:35:23 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
function fillCard(card, data) {
|
|
|
|
|
//Key
|
|
|
|
|
card.find('.issue-id').text(data.key);
|
2015-04-18 01:34:10 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
//Type
|
|
|
|
|
card.find(".issue-icon").attr("type", data.type);
|
2015-04-18 01:34:10 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
//Summary
|
|
|
|
|
card.find('.issue-summary').text(data.summary);
|
2015-04-18 01:34:10 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
//Description
|
|
|
|
|
if (data.description) {
|
|
|
|
|
card.find('.issue-description').html(data.description);
|
|
|
|
|
} else {
|
|
|
|
|
card.find(".issue-description").addClass("hidden");
|
|
|
|
|
}
|
2015-04-18 01:34:10 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
//Assignee
|
|
|
|
|
if (data.assignee) {
|
|
|
|
|
if (data.avatarUrl) {
|
|
|
|
|
card.find(".issue-assignee").css("background-image", "url('" + data.avatarUrl + "')");
|
|
|
|
|
} else {
|
|
|
|
|
card.find(".issue-assignee").text(data.assignee[0].toUpperCase());
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2015-12-10 14:15:05 +01:00
|
|
|
card.find(".issue-assignee").remove();
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
2015-04-18 01:34:10 +02:00
|
|
|
|
2016-08-30 13:38:11 +02:00
|
|
|
//ETH taurus-xft
|
|
|
|
|
if (data.externalIssueId) {
|
|
|
|
|
card.find(".issue-external-id").text(data.externalIssueId);
|
|
|
|
|
} else {
|
|
|
|
|
card.find(".issue-external-id").remove();
|
|
|
|
|
}
|
2016-08-30 16:49:11 +02:00
|
|
|
if (data.sdpNumber) {
|
|
|
|
|
card.find(".issue-sdp-number").text(data.sdpNumber);
|
|
|
|
|
} else {
|
|
|
|
|
card.find(".issue-sdp-number").remove();
|
|
|
|
|
}
|
2016-08-30 13:38:11 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
//Due-Date
|
|
|
|
|
if (data.dueDate) {
|
|
|
|
|
card.find(".issue-due-date").text(data.dueDate);
|
|
|
|
|
} else {
|
2015-12-10 14:15:05 +01:00
|
|
|
card.find(".issue-due-box").remove();
|
2015-05-12 12:04:40 +02:00
|
|
|
}
|
2015-04-18 01:34:10 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
//Attachment
|
|
|
|
|
if (data.hasAttachment) {} else {
|
2015-12-10 14:15:05 +01:00
|
|
|
card.find('.issue-attachment').remove();
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
2015-06-02 13:42:42 +02:00
|
|
|
|
2016-05-23 09:19:34 +02:00
|
|
|
//Estimate
|
|
|
|
|
if (data.estimate) {
|
|
|
|
|
card.find(".issue-estimate").text(data.estimate);
|
2015-06-07 13:39:29 +02:00
|
|
|
} else {
|
2015-12-10 14:15:05 +01:00
|
|
|
card.find(".issue-estimate").remove();
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
2015-06-02 14:16:40 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
//Epic
|
2015-11-26 19:52:35 +01:00
|
|
|
if (data.superIssue) {
|
|
|
|
|
card.find(".issue-epic-id").text(data.superIssue.key);
|
|
|
|
|
card.find(".issue-epic-name").text(data.superIssue.summary);
|
2015-06-07 13:39:29 +02:00
|
|
|
} else {
|
2015-12-10 14:15:05 +01:00
|
|
|
card.find(".issue-epic-box").remove();
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
2015-06-02 22:36:36 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
//QR-Code
|
|
|
|
|
var qrCodeUrl = 'https://chart.googleapis.com/chart?cht=qr&chs=256x256&chld=L|1&chl=' + encodeURIComponent(data.url);
|
|
|
|
|
card.find(".issue-qr-code").css("background-image", "url('" + qrCodeUrl + "')");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function styleCards() {
|
2015-11-27 14:06:46 +01:00
|
|
|
var settings = global.settings;
|
2015-12-16 18:21:30 +01:00
|
|
|
var printFrame = global.printFrame
|
2015-06-07 13:39:29 +02:00
|
|
|
|
|
|
|
|
// hide/show description
|
2015-12-27 22:51:13 +01:00
|
|
|
$(".issue-description", printFrame.document).toggle(!settings.hideDescription);
|
2015-06-07 13:39:29 +02:00
|
|
|
// hide/show assignee
|
2015-12-27 22:51:13 +01:00
|
|
|
$(".issue-assignee", printFrame.document).toggle(!settings.hideAssignee);
|
2016-05-23 09:19:34 +02:00
|
|
|
// hide/show due date
|
2015-12-27 22:51:13 +01:00
|
|
|
$(".issue-due-box", printFrame.document).toggle(!settings.hideDueDate);
|
2016-05-23 09:19:34 +02:00
|
|
|
// hide/show estimate
|
|
|
|
|
$(".issue-estimate", printFrame.document).toggle(!settings.hideEstimate);
|
2015-12-10 14:15:05 +01:00
|
|
|
// hide/show cr code
|
2015-12-27 22:51:13 +01:00
|
|
|
$(".issue-qr-code", printFrame.document).toggle(!settings.hideQrCode);
|
2015-06-02 22:36:36 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
// enable/disable single card page
|
2015-12-27 22:51:13 +01:00
|
|
|
$(".card", printFrame.document).css({ 'page-break-after' : '', 'float' : '', 'margin-bottom': '' });
|
2015-11-27 14:06:46 +01:00
|
|
|
if (settings.singleCardPage) {
|
2015-12-27 22:51:13 +01:00
|
|
|
$(".card", printFrame.document).css({ 'page-break-after': 'always', 'float': 'none', 'margin-bottom': '20px' });
|
2015-12-18 06:52:59 +01:00
|
|
|
} else {
|
2015-12-27 22:51:13 +01:00
|
|
|
$(".card", printFrame.document).each(function(index, element){
|
2015-12-18 06:52:59 +01:00
|
|
|
if(index % (settings.colCount * settings.rowCount ) >= (settings.colCount * (settings.rowCount - 1))){
|
2015-12-27 22:51:13 +01:00
|
|
|
$(element).css({ 'margin-bottom': '20px' });
|
2015-12-18 06:52:59 +01:00
|
|
|
}
|
|
|
|
|
});
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function scaleCards() {
|
2015-11-27 14:06:46 +01:00
|
|
|
var settings = global.settings;
|
2015-12-16 18:21:30 +01:00
|
|
|
var printFrame = global.printFrame;
|
2015-11-27 17:59:38 +01:00
|
|
|
|
2015-11-30 13:31:06 +01:00
|
|
|
var scaleValue = settings.scale * 2.0;
|
2015-11-27 17:59:38 +01:00
|
|
|
var scaleRoot;
|
2015-11-30 13:29:00 +01:00
|
|
|
if(scaleValue < 0) {
|
|
|
|
|
scaleRoot = 1.0 / (1.0 - scaleValue);
|
2015-11-27 17:59:38 +01:00
|
|
|
} else {
|
2015-11-30 13:29:00 +01:00
|
|
|
scaleRoot = 1.0 * (1.0 + scaleValue);
|
2015-11-27 17:59:38 +01:00
|
|
|
}
|
|
|
|
|
|
2015-11-27 14:06:46 +01:00
|
|
|
var rowCount = settings.rowCount;
|
|
|
|
|
var columnCount = settings.colCount;
|
2015-06-07 13:39:29 +02:00
|
|
|
|
|
|
|
|
// scale
|
|
|
|
|
|
2015-11-24 09:44:23 +01:00
|
|
|
// reset scale
|
2015-12-27 22:51:13 +01:00
|
|
|
$("html", printFrame.document).css("font-size", scaleRoot + "cm");
|
|
|
|
|
$("#gridStyle", printFrame.document).remove();
|
2015-06-07 13:39:29 +02:00
|
|
|
|
2015-11-27 16:35:19 +01:00
|
|
|
// calculate scale
|
|
|
|
|
|
2015-12-27 22:51:13 +01:00
|
|
|
var bodyElement = $("body", printFrame.document);
|
2015-11-27 16:35:19 +01:00
|
|
|
var cardMaxWidth = Math.floor(bodyElement.outerWidth() / columnCount);
|
|
|
|
|
var cardMaxHeight = Math.floor(bodyElement.outerHeight() / rowCount);
|
2015-06-07 13:39:29 +02:00
|
|
|
|
2015-12-27 22:51:13 +01:00
|
|
|
var cardElement = $(".card", printFrame.document);
|
2016-04-21 12:31:38 +02:00
|
|
|
var cardMinWidth = cardElement.css("min-width") ? cardElement.css("min-width").replace("px", "") : 0;
|
|
|
|
|
var cardMinHeight = cardElement.css("min-height") ? cardElement.css("min-height").replace("px", "") : 0;
|
2015-06-07 13:39:29 +02:00
|
|
|
|
2015-11-27 16:35:19 +01:00
|
|
|
var scaleWidth = cardMaxWidth / cardMinWidth ;
|
|
|
|
|
var scaleHeight = cardMaxHeight / cardMinHeight ;
|
2015-11-27 07:52:48 +01:00
|
|
|
var scale = Math.min(scaleWidth, scaleHeight, 1);
|
2015-11-27 16:35:19 +01:00
|
|
|
|
2015-11-27 17:12:33 +01:00
|
|
|
// scale
|
2015-12-27 22:51:13 +01:00
|
|
|
$("html", printFrame.document).css("font-size", ( scaleRoot * scale ) + "cm");
|
2015-11-27 17:12:33 +01:00
|
|
|
|
2015-12-17 22:22:39 +01:00
|
|
|
// grid size
|
2015-11-24 09:02:18 +01:00
|
|
|
var style = document.createElement('style');
|
2015-12-17 22:22:39 +01:00
|
|
|
style.id = 'gridStyle';
|
2015-11-24 09:02:18 +01:00
|
|
|
style.type = 'text/css';
|
2015-12-17 22:22:39 +01:00
|
|
|
style.innerHTML = ".card { "+
|
2015-12-18 06:52:59 +01:00
|
|
|
"width: calc( 100% / " + columnCount + " );" +
|
2015-12-17 22:22:39 +01:00
|
|
|
"height: calc( 100% / " + rowCount + " );"+
|
|
|
|
|
"}";
|
2015-12-27 22:51:13 +01:00
|
|
|
$("head", printFrame.document).append(style);
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function cropCards() {
|
2015-12-29 11:50:41 +01:00
|
|
|
var cardElements = Array.from(global.printFrame.document.querySelectorAll(".card"));
|
|
|
|
|
cardElements.forEach(function(cardElement) {
|
2015-06-07 13:39:29 +02:00
|
|
|
var cardContent = cardElement.querySelectorAll(".card-body")[0];
|
|
|
|
|
if (cardContent.scrollHeight > cardContent.offsetHeight) {
|
|
|
|
|
cardContent.classList.add("zigzag");
|
|
|
|
|
} else {
|
|
|
|
|
cardContent.classList.remove("zigzag");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2015-06-02 13:42:42 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
function closePrintPreview() {
|
2015-12-27 22:51:13 +01:00
|
|
|
$("#card-printer-iframe").remove();
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//############################################################################################################################
|
|
|
|
|
//############################################################################################################################
|
|
|
|
|
//############################################################################################################################
|
|
|
|
|
|
|
|
|
|
// http://www.cssdesk.com/T9hXg
|
|
|
|
|
|
2015-11-25 12:56:03 +01:00
|
|
|
function printPreviewElement() {
|
2015-12-27 22:51:13 +01:00
|
|
|
var result = $('<div/>').html(global.printPreviewHtml).contents();
|
2015-06-07 13:39:29 +02:00
|
|
|
|
|
|
|
|
// info
|
|
|
|
|
result.find("#report-issue").click(function(event) {
|
2016-08-30 11:26:22 +02:00
|
|
|
window.open('https://static.ragnarok.yvan.hu/jira-card-printer/issues');
|
2015-06-07 13:39:29 +02:00
|
|
|
return false;
|
|
|
|
|
});
|
2015-06-02 13:42:42 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
result.find("#about").click(function(event) {
|
|
|
|
|
window.open('http://qoomon.blogspot.de/2014/01/jira-issue-card-printer-bookmarklet.html');
|
|
|
|
|
return false;
|
|
|
|
|
});
|
2015-06-02 22:36:36 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
// enable single card page
|
2015-06-02 13:42:42 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
result.find("#single-card-page-checkbox").click(function() {
|
2015-11-27 14:06:46 +01:00
|
|
|
global.settings.singleCardPage = this.checked;
|
|
|
|
|
saveSettings();
|
2015-06-07 13:39:29 +02:00
|
|
|
redrawCards();
|
|
|
|
|
return true;
|
|
|
|
|
});
|
2015-06-02 13:42:42 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
// hide description
|
2015-06-02 13:42:42 +02:00
|
|
|
|
2015-12-11 11:16:50 +01:00
|
|
|
result.find("#description-checkbox").click(function() {
|
|
|
|
|
global.settings.hideDescription = !this.checked;
|
2015-11-27 14:06:46 +01:00
|
|
|
saveSettings();
|
2015-06-07 13:39:29 +02:00
|
|
|
redrawCards();
|
|
|
|
|
return true;
|
|
|
|
|
});
|
2015-06-02 13:42:42 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
// show assignee
|
2015-04-18 01:34:10 +02:00
|
|
|
|
2015-12-11 11:16:50 +01:00
|
|
|
result.find("#assignee-checkbox").click(function() {
|
|
|
|
|
global.settings.hideAssignee = !this.checked;
|
2015-11-27 14:06:46 +01:00
|
|
|
saveSettings();
|
2015-06-07 13:39:29 +02:00
|
|
|
redrawCards();
|
|
|
|
|
return true;
|
|
|
|
|
});
|
2015-04-18 01:34:10 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
// show due date
|
2015-04-18 01:34:10 +02:00
|
|
|
|
2015-12-11 11:16:50 +01:00
|
|
|
result.find("#due-date-checkbox").click(function() {
|
|
|
|
|
global.settings.hideDueDate = !this.checked;
|
2015-11-27 14:06:46 +01:00
|
|
|
saveSettings();
|
2015-06-07 13:39:29 +02:00
|
|
|
redrawCards();
|
|
|
|
|
return true;
|
|
|
|
|
});
|
2015-04-18 01:34:10 +02:00
|
|
|
|
2016-05-23 09:19:34 +02:00
|
|
|
// show due date
|
|
|
|
|
|
|
|
|
|
result.find("#estimate-checkbox").click(function() {
|
|
|
|
|
global.settings.hideEstimate = !this.checked;
|
|
|
|
|
saveSettings();
|
|
|
|
|
redrawCards();
|
|
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
|
|
2015-12-10 14:15:05 +01:00
|
|
|
// show QR Code
|
|
|
|
|
|
2015-12-11 11:16:50 +01:00
|
|
|
result.find("#qr-code-checkbox").click(function() {
|
2015-12-11 11:30:09 +01:00
|
|
|
global.settings.hideQrCode = !this.checked;
|
2015-12-10 14:15:05 +01:00
|
|
|
saveSettings();
|
|
|
|
|
redrawCards();
|
|
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
// scale font
|
2015-05-31 21:55:14 +02:00
|
|
|
|
2015-11-30 13:26:37 +01:00
|
|
|
result.find("#scaleRange").on("input", function() {
|
2015-12-27 22:51:13 +01:00
|
|
|
global.settings.scale = $(this).val();
|
2015-11-27 14:06:46 +01:00
|
|
|
saveSettings();
|
2015-06-07 13:39:29 +02:00
|
|
|
redrawCards();
|
|
|
|
|
});
|
2015-06-02 14:16:40 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
// grid
|
2015-05-31 21:55:14 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
result.find("#rowCount").on("input", function() {
|
2015-12-27 22:51:13 +01:00
|
|
|
global.settings.rowCount = $(this).val();
|
2015-11-27 14:06:46 +01:00
|
|
|
saveSettings();
|
2015-06-07 13:39:29 +02:00
|
|
|
redrawCards();
|
|
|
|
|
});
|
|
|
|
|
result.find("#rowCount").click(function() {
|
|
|
|
|
this.select();
|
|
|
|
|
});
|
2015-05-31 21:55:14 +02:00
|
|
|
|
2015-04-18 01:34:10 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
result.find("#columnCount").on("input", function() {
|
2015-12-27 22:51:13 +01:00
|
|
|
global.settings.colCount = $(this).val();
|
2015-11-27 14:06:46 +01:00
|
|
|
saveSettings();
|
2015-06-07 13:39:29 +02:00
|
|
|
redrawCards();
|
|
|
|
|
});
|
|
|
|
|
result.find("#columnCount").click(function() {
|
|
|
|
|
this.select();
|
|
|
|
|
});
|
2015-04-18 01:34:10 +02:00
|
|
|
|
|
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
// print
|
2015-04-18 01:34:10 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
result.find("#card-print-dialog-print")
|
|
|
|
|
.click(function(event) {
|
|
|
|
|
print();
|
|
|
|
|
return false;
|
|
|
|
|
});
|
2015-05-12 11:35:23 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
// closePrintPreview
|
2015-04-18 01:34:10 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
result.find("#card-print-dialog-cancel")
|
|
|
|
|
.click(function(event) {
|
|
|
|
|
closePrintPreview();
|
|
|
|
|
return false;
|
|
|
|
|
});
|
2015-04-18 01:34:10 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
result.click(function(event) {
|
2015-11-25 12:56:03 +01:00
|
|
|
if (event.target == this) {
|
|
|
|
|
closePrintPreview();
|
|
|
|
|
}
|
2015-06-07 13:39:29 +02:00
|
|
|
return true;
|
|
|
|
|
});
|
2015-04-18 01:34:10 +02:00
|
|
|
|
2015-12-27 22:51:13 +01:00
|
|
|
$(document).keyup(function(e) {
|
2015-11-25 12:56:03 +01:00
|
|
|
if (e.keyCode == 27) { // ESC
|
2015-06-07 13:39:29 +02:00
|
|
|
closePrintPreview();
|
|
|
|
|
}
|
|
|
|
|
});
|
2015-04-18 01:34:10 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
// prevent background scrolling
|
|
|
|
|
result.scroll(function(event) {
|
2015-11-25 12:56:03 +01:00
|
|
|
return false;
|
2015-06-07 13:39:29 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-16 18:21:30 +01:00
|
|
|
function printPreviewElementStyle() {
|
2015-12-27 22:51:13 +01:00
|
|
|
var result = $(document.createElement('style'))
|
2015-06-07 13:39:29 +02:00
|
|
|
.attr("type", "text/css")
|
2015-11-25 12:56:03 +01:00
|
|
|
.html(global.printPreviewCss);
|
2015-06-07 13:39:29 +02:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-24 08:31:30 +01:00
|
|
|
// card layout: http://jsfiddle.net/qoomon/ykbLb2pw/76
|
2015-11-25 12:01:42 +01:00
|
|
|
|
2015-11-25 08:45:13 +01:00
|
|
|
function cardElement(issueKey) {
|
2015-12-27 22:51:13 +01:00
|
|
|
var result = $('<div/>').html(global.cardHtml).contents()
|
2015-06-07 13:39:29 +02:00
|
|
|
.attr("id", issueKey)
|
2015-11-25 12:56:03 +01:00
|
|
|
return result;
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
|
|
|
|
|
2015-11-25 12:56:03 +01:00
|
|
|
function cardElementStyle() {
|
2015-12-27 22:51:13 +01:00
|
|
|
var result = $(document.createElement('style'))
|
2015-06-07 13:39:29 +02:00
|
|
|
.attr("type", "text/css")
|
2015-11-25 12:09:32 +01:00
|
|
|
.html(global.cardCss);
|
2015-06-07 13:39:29 +02:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-29 11:50:41 +01:00
|
|
|
//############################################################################################################################
|
|
|
|
|
// APP Specific Functions
|
|
|
|
|
//############################################################################################################################
|
|
|
|
|
|
|
|
|
|
function getIssueTrackers(){
|
|
|
|
|
var issueTrackers = []
|
|
|
|
|
|
|
|
|
|
var jiraFunctions = (function(module) {
|
2016-04-21 12:31:38 +02:00
|
|
|
module.name = "JIRA";
|
2016-05-23 09:19:34 +02:00
|
|
|
|
2016-05-19 15:37:47 +02:00
|
|
|
module.baseUrl = function() {
|
|
|
|
|
var jiraBaseUrl = window.location.origin;
|
2016-05-20 09:22:30 +02:00
|
|
|
try { jiraBaseUrl = $("input[title='baseURL']").attr('value'); } catch(ex){}
|
2016-05-19 15:37:47 +02:00
|
|
|
return jiraBaseUrl
|
|
|
|
|
}
|
2015-12-29 11:50:41 +01:00
|
|
|
|
|
|
|
|
module.isEligible = function(){
|
|
|
|
|
return $("meta[name='application-name'][ content='JIRA']").length > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.getSelectedIssueKeyList = function() {
|
|
|
|
|
|
|
|
|
|
//Issues
|
2016-04-21 12:31:38 +02:00
|
|
|
if (/.*\/issues\/.*/g.test(document.URL)) {
|
2016-05-23 09:19:34 +02:00
|
|
|
|
2016-05-23 09:23:54 +02:00
|
|
|
var issues = $('.issue-list > li').map(function() {
|
2016-05-23 09:19:34 +02:00
|
|
|
return $(this).attr('data-key');
|
2015-12-29 11:50:41 +01:00
|
|
|
});
|
2016-05-23 09:19:34 +02:00
|
|
|
|
|
|
|
|
//backward compatibility
|
|
|
|
|
if (issues.empty()) {
|
|
|
|
|
issues = $('tr[data-issuekey]').map(function() {
|
|
|
|
|
return $(this).attr('data-issuekey');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return issues;
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Browse
|
|
|
|
|
if (/.*\/browse\/.*/g.test(document.URL)) {
|
2015-12-29 16:20:36 +01:00
|
|
|
return [document.URL.match(/.*\/browse\/([^?]*).*/)[1]];
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Project
|
|
|
|
|
if (/.*\/projects\/.*/g.test(document.URL)) {
|
2015-12-29 16:20:36 +01:00
|
|
|
return [document.URL.match(/.*\/projects\/[^\/]*\/[^\/]*\/([^?]*).*/)[1]];
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RapidBoard
|
|
|
|
|
if (/.*\/secure\/RapidBoard.jspa.*/g.test(document.URL)) {
|
|
|
|
|
return $('div[data-issue-key].ghx-selected').map(function() {
|
|
|
|
|
return $(this).attr('data-issue-key');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return [];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.getCardData = function(issueKey) {
|
|
|
|
|
var promises = [];
|
|
|
|
|
var issueData = {};
|
|
|
|
|
|
|
|
|
|
promises.push(module.getIssueData(issueKey).then(function(data) {
|
|
|
|
|
var promises = [];
|
|
|
|
|
issueData.key = data.key;
|
|
|
|
|
issueData.type = data.fields.issuetype.name.toLowerCase();
|
|
|
|
|
issueData.summary = data.fields.summary;
|
|
|
|
|
issueData.description = data.renderedFields.description;
|
|
|
|
|
|
|
|
|
|
if (data.fields.assignee) {
|
|
|
|
|
issueData.assignee = data.fields.assignee.displayName;
|
|
|
|
|
var avatarUrl = data.fields.assignee.avatarUrls['48x48'];
|
|
|
|
|
if (avatarUrl.indexOf("ownerId=") >= 0) {
|
|
|
|
|
issueData.avatarUrl = avatarUrl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data.fields.duedate) {
|
|
|
|
|
issueData.dueDate = formatDate(new Date(data.fields.duedate));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
issueData.hasAttachment = data.fields.attachment.length > 0;
|
2016-05-23 09:19:34 +02:00
|
|
|
issueData.estimate = data.fields.storyPoints;
|
2015-12-29 11:50:41 +01:00
|
|
|
|
|
|
|
|
if (data.fields.parent) {
|
|
|
|
|
promises.push(module.getIssueData(data.fields.parent.key).then(function(data) {
|
|
|
|
|
issueData.superIssue = {};
|
|
|
|
|
issueData.superIssue.key = data.key;
|
|
|
|
|
issueData.superIssue.summary = data.fields.summary;
|
|
|
|
|
}));
|
|
|
|
|
} else if (data.fields.epicLink) {
|
|
|
|
|
promises.push(module.getIssueData(data.fields.epicLink).then(function(data) {
|
|
|
|
|
issueData.superIssue = {};
|
|
|
|
|
issueData.superIssue.key = data.key;
|
|
|
|
|
issueData.superIssue.summary = data.fields.epicName;
|
|
|
|
|
}));
|
|
|
|
|
}
|
2016-05-23 09:19:34 +02:00
|
|
|
|
2016-08-30 15:41:19 +02:00
|
|
|
// ETH edvidan
|
2016-08-29 16:38:01 +02:00
|
|
|
if(data.fields.externalIssueId) {
|
2016-08-30 15:41:19 +02:00
|
|
|
if(/^[0-9]{4,}$/.test(data.fields.externalIssueId)) {
|
|
|
|
|
issueData.externalIssueId = "Bug " + data.fields.externalIssueId;
|
|
|
|
|
} else {
|
|
|
|
|
issueData.externalIssueId = data.fields.externalIssueId;
|
|
|
|
|
}
|
2016-08-29 16:38:01 +02:00
|
|
|
}
|
|
|
|
|
|
2016-08-30 16:49:11 +02:00
|
|
|
if(data.fields.sdpNumber) {
|
|
|
|
|
issueData.sdpNumber = "SDP" + data.fields.sdpNumber[0];
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-19 15:37:47 +02:00
|
|
|
issueData.url = module.baseUrl() + "/browse/" + issueData.key;
|
2015-12-29 11:50:41 +01:00
|
|
|
|
|
|
|
|
return Promise.all(promises);
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
return Promise.all(promises).then(function(results){return issueData;});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.getIssueData = function(issueKey) {
|
|
|
|
|
//https://docs.atlassian.com/jira/REST/latest/
|
2016-05-19 15:37:47 +02:00
|
|
|
var url = module.baseUrl() + '/rest/api/2/issue/' + issueKey + '?expand=renderedFields,names';
|
2015-12-29 11:50:41 +01:00
|
|
|
console.log("IssueUrl: " + url);
|
|
|
|
|
//console.log("Issue: " + issueKey + " Loading...");
|
|
|
|
|
return httpGetJSON(url).then(function(responseData) {
|
|
|
|
|
//console.log("Issue: " + issueKey + " Loaded!");
|
|
|
|
|
// add custom fields with field names
|
|
|
|
|
$.each(responseData.names, function(key, value) {
|
|
|
|
|
if (key.startsWith("customfield_")) {
|
|
|
|
|
var fieldName = value.toCamelCase();
|
2016-08-12 14:57:47 +02:00
|
|
|
var fieldValue = responseData.fields[key];
|
|
|
|
|
|
|
|
|
|
//deposit-solutions specific field mapping
|
|
|
|
|
if(/.*\.deposit-solutions.com/g.test(window.location.hostname)){
|
|
|
|
|
if (key == 'customfield_10006'){
|
|
|
|
|
fieldName = 'epicLink'
|
|
|
|
|
}
|
|
|
|
|
if (key == 'customfield_10007'){
|
|
|
|
|
fieldName = 'epicName'
|
|
|
|
|
}
|
|
|
|
|
if (key == 'customfield_10002'){
|
|
|
|
|
fieldName = 'storyPoints'
|
|
|
|
|
}
|
2016-08-10 17:01:59 +02:00
|
|
|
}
|
2016-08-29 16:38:01 +02:00
|
|
|
|
|
|
|
|
// ETH- taurusxft customfield_10010-val
|
|
|
|
|
if(/jirapducc.mo.ca.am.ericsson.se/g.test(window.location.hostname)){
|
|
|
|
|
if (key == 'customfield_10010'){
|
|
|
|
|
fieldName = 'externalIssueId'
|
|
|
|
|
}
|
2016-08-30 16:49:11 +02:00
|
|
|
if (key == 'customfield_10816'){
|
|
|
|
|
fieldName = 'sdpNumber'
|
|
|
|
|
}
|
2016-08-29 16:38:01 +02:00
|
|
|
}
|
|
|
|
|
|
2016-08-12 14:57:47 +02:00
|
|
|
//lufthansa specific field mapping
|
|
|
|
|
if(/.*trackspace.lhsystems.com/g.test(window.location.hostname)){
|
|
|
|
|
if (key == 'Xcustomfield_10006'){
|
|
|
|
|
fieldName = 'epicLink'
|
|
|
|
|
}
|
|
|
|
|
if (key == 'Xcustomfield_10007'){
|
|
|
|
|
fieldName = 'epicName'
|
|
|
|
|
}
|
|
|
|
|
if (key == 'Xcustomfield_10002'){
|
|
|
|
|
fieldName = 'storyPoints'
|
|
|
|
|
}
|
|
|
|
|
if (fieldName == 'desiredDate') {
|
|
|
|
|
fieldName ='dueDate'
|
|
|
|
|
fieldValue = formatDate(new Date(fieldValue));
|
|
|
|
|
}
|
2016-08-10 17:25:36 +02:00
|
|
|
}
|
2016-08-29 16:38:01 +02:00
|
|
|
|
2015-12-29 11:50:41 +01:00
|
|
|
//console.log("add new field: " + fieldName + " with value from " + key);
|
2016-08-12 14:57:47 +02:00
|
|
|
responseData.fields[fieldName] = fieldValue;
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return responseData;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return module;
|
|
|
|
|
}({}));
|
|
|
|
|
issueTrackers.push(jiraFunctions);
|
|
|
|
|
|
|
|
|
|
var youTrackFunctions = (function(module) {
|
2016-04-21 12:31:38 +02:00
|
|
|
module.name = "YouTrack";
|
2015-12-29 11:50:41 +01:00
|
|
|
|
|
|
|
|
module.isEligible = function(){
|
|
|
|
|
return /.*myjetbrains.com\/youtrack\/.*/g.test(document.URL) || /.*youtrack.jetbrains.com\/.*/g.test(document.URL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.getSelectedIssueKeyList = function() {
|
|
|
|
|
//Detail View
|
|
|
|
|
if (/.*\/issue\/.*/g.test(document.URL)) {
|
2016-04-21 12:31:38 +02:00
|
|
|
return [document.URL.match(/.*\/issue\/([^?]*).*/)[1]];
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Agile Board
|
|
|
|
|
if (/.*\/rest\/agile.*/g.test(document.URL)) {
|
|
|
|
|
return $('div.sb-task-focused').map(function() {
|
|
|
|
|
return $(this).attr('id');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return [];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.getCardData = function(issueKey) {
|
|
|
|
|
var promises = [];
|
|
|
|
|
var issueData = {};
|
|
|
|
|
|
|
|
|
|
promises.push(module.getIssueData(issueKey).then(function(data) {
|
|
|
|
|
issueData.key = data.id;
|
|
|
|
|
issueData.type = data.field.type[0];
|
|
|
|
|
issueData.summary = data.field.summary;
|
|
|
|
|
issueData.description = data.field.description;
|
|
|
|
|
|
|
|
|
|
if (data.field.assignee) {
|
|
|
|
|
issueData.assignee = data.field.assignee[0].fullName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data.field.attachments) {
|
|
|
|
|
issueData.hasAttachment = data.field.attachments.length > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
issueData.url = window.location.origin + "/youtrack/issue/" + issueData.key;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
return Promise.all(promises).then(function(results){return issueData;});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.getIssueData = function(issueKey) {
|
|
|
|
|
var url = '/youtrack/rest/issue/' + issueKey + '?';
|
|
|
|
|
console.log("IssueUrl: " + url);
|
|
|
|
|
//console.log("Issue: " + issueKey + " Loading...");
|
|
|
|
|
return httpGetJSON(url).then(function(responseData) {
|
|
|
|
|
//console.log("Issue: " + issueKey + " Loaded!");
|
|
|
|
|
$.each(responseData.field, function(key, value) {
|
|
|
|
|
// add fields with field names
|
|
|
|
|
var fieldName = value.name.toCamelCase();
|
|
|
|
|
//console.log("add new field: " + newFieldId + " with value from " + fieldName);
|
|
|
|
|
responseData.field[fieldName] = value.value;
|
|
|
|
|
});
|
|
|
|
|
return responseData;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return module;
|
|
|
|
|
}({}));
|
|
|
|
|
issueTrackers.push(youTrackFunctions);
|
|
|
|
|
|
|
|
|
|
var pivotalTrackerFunctions = (function(module) {
|
2016-04-21 12:31:38 +02:00
|
|
|
module.name = "PivotalTracker";
|
2015-12-29 11:50:41 +01:00
|
|
|
|
|
|
|
|
module.isEligible = function(){
|
|
|
|
|
return /.*pivotaltracker.com\/.*/g.test(document.URL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.getSelectedIssueKeyList = function() {
|
|
|
|
|
//Single Story
|
|
|
|
|
if (/.*\/stories\/.*/g.test(document.URL)) {
|
2015-12-29 16:20:36 +01:00
|
|
|
return [document.URL.match(/.*\/stories\/([^?]*).*/)[1]];
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
|
|
|
|
|
2016-02-12 13:15:31 +01:00
|
|
|
// Project Board
|
2015-12-29 11:50:41 +01:00
|
|
|
if (/.*\/projects\/.*/g.test(document.URL)) {
|
2016-02-12 14:51:21 +01:00
|
|
|
return $('.story[data-id]:has(.selector.selected)').map(function() {
|
2015-12-29 11:50:41 +01:00
|
|
|
return $(this).attr('data-id');
|
|
|
|
|
});
|
|
|
|
|
}
|
2016-04-21 12:31:38 +02:00
|
|
|
|
2016-02-12 13:15:31 +01:00
|
|
|
// Workspace Board
|
|
|
|
|
if (/.*\/workspaces\/.*/g.test(document.URL)) {
|
2016-02-12 14:51:21 +01:00
|
|
|
return $('.story[data-id]:has(.selector.selected)').map(function() {
|
2016-02-12 13:15:31 +01:00
|
|
|
return $(this).attr('data-id');
|
|
|
|
|
});
|
|
|
|
|
}
|
2016-04-21 12:31:38 +02:00
|
|
|
|
2015-12-29 11:50:41 +01:00
|
|
|
return [];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.getCardData = function(issueKey) {
|
|
|
|
|
var promises = [];
|
|
|
|
|
var issueData = {};
|
|
|
|
|
|
|
|
|
|
promises.push(module.getIssueData(issueKey).then(function(data) {
|
|
|
|
|
issueData.key = data.id;
|
|
|
|
|
issueData.type = data.kind.toLowerCase();
|
|
|
|
|
issueData.summary = data.name;
|
|
|
|
|
issueData.description = data.description;
|
|
|
|
|
|
|
|
|
|
if (data.owned_by && data.owned_by.length > 0) {
|
|
|
|
|
issueData.assignee = data.owner_ids[0].name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data.deadline) {
|
|
|
|
|
issueData.dueDate = formatDate(new Date(data.deadline));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
|
issueData.hasAttachment = false;
|
2016-05-23 09:19:34 +02:00
|
|
|
issueData.estimate = data.estimate;
|
2015-12-29 11:50:41 +01:00
|
|
|
|
|
|
|
|
issueData.url = data.url;
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
return Promise.all(promises).then(function(results){return issueData;});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.getIssueData = function(issueKey) {
|
|
|
|
|
//http://www.pivotaltracker.com/help/api
|
|
|
|
|
var url = 'https://www.pivotaltracker.com/services/v5/stories/' + issueKey + "?fields=name,kind,description,story_type,owned_by(name),comments(file_attachments(kind)),estimate,deadline";
|
|
|
|
|
console.log("IssueUrl: " + url);
|
|
|
|
|
//console.log("Issue: " + issueKey + " Loading...");
|
|
|
|
|
return httpGetJSON(url);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return module;
|
|
|
|
|
}({}));
|
|
|
|
|
issueTrackers.push(pivotalTrackerFunctions);
|
|
|
|
|
|
|
|
|
|
var trelloFunctions = (function(module) {
|
2016-04-21 12:31:38 +02:00
|
|
|
module.name = "trello";
|
2015-12-29 11:50:41 +01:00
|
|
|
|
|
|
|
|
module.isEligible = function(){
|
|
|
|
|
return /.*trello.com\/.*/g.test(document.URL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.getSelectedIssueKeyList = function() {
|
2016-08-25 15:51:13 +02:00
|
|
|
//Board View
|
2016-08-25 15:24:09 +02:00
|
|
|
if (/.*\/b\/.*/g.test(document.URL)) {
|
2016-08-25 15:51:13 +02:00
|
|
|
// open card composer
|
|
|
|
|
var issueKeys = $( ".card-composer").parent().find(".list-card > .list-card-details > .list-card-title").map(function() {
|
2016-08-25 15:24:09 +02:00
|
|
|
return $(this).attr("href").match(/.*\/c\/([^/]*).*/)[1];
|
|
|
|
|
});
|
2016-08-29 16:38:01 +02:00
|
|
|
|
2016-08-25 15:51:13 +02:00
|
|
|
//read only board
|
2016-08-29 16:38:01 +02:00
|
|
|
|
2016-08-25 15:51:13 +02:00
|
|
|
var issueKeys2 = $( "textarea.list-header-name.is-editing" ).parent().parent().find(".list-cards > .list-card > .list-card-details > .list-card-title").map(function() {
|
|
|
|
|
return $(this).attr("href").match(/.*\/c\/([^/]*).*/)[1];
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return jQuery.merge(issueKeys,issueKeys2 );
|
2016-08-25 15:24:09 +02:00
|
|
|
}
|
2016-08-29 16:38:01 +02:00
|
|
|
|
2015-12-29 11:50:41 +01:00
|
|
|
//Card View
|
|
|
|
|
if (/.*\/c\/.*/g.test(document.URL)) {
|
2015-12-29 16:20:36 +01:00
|
|
|
return [document.URL.match(/.*\/c\/([^/]*).*/)[1]];
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
2016-08-29 16:38:01 +02:00
|
|
|
|
2015-12-29 11:50:41 +01:00
|
|
|
return [];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.getCardData = function(issueKey, callback) {
|
|
|
|
|
var promises = [];
|
|
|
|
|
var issueData = {};
|
|
|
|
|
|
|
|
|
|
promises.push(module.getIssueData(issueKey).then(function(data) {
|
|
|
|
|
issueData.key = data.idShort;
|
|
|
|
|
|
2015-12-29 16:20:36 +01:00
|
|
|
// TODO get type from label name
|
2015-12-29 11:50:41 +01:00
|
|
|
issueData.type = 'default';
|
|
|
|
|
|
|
|
|
|
issueData.summary = data.name;
|
|
|
|
|
issueData.description = data.desc;
|
|
|
|
|
|
|
|
|
|
if (data.members && data.members.length > 0) {
|
|
|
|
|
issueData.assignee = data.members[0].fullName;
|
|
|
|
|
issueData.avatarUrl = "https://trello-avatars.s3.amazonaws.com/" + data.members[0].avatarHash + "/170.png";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data.due) {
|
|
|
|
|
issueData.dueDate = formatDate(new Date(data.due));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
issueData.hasAttachment = data.attachments > 0;
|
|
|
|
|
issueData.url = data.shortUrl;
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
return Promise.all(promises).then(function(results){return issueData;});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.getIssueData = function(issueKey) {
|
2015-12-29 16:20:36 +01:00
|
|
|
var url = "/1/cards/" + issueKey + "?members=true";
|
2015-12-29 11:50:41 +01:00
|
|
|
console.log("IssueUrl: " + url);
|
|
|
|
|
//console.log("Issue: " + issueKey + " Loading...");
|
|
|
|
|
return httpGetJSON(url);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return module;
|
|
|
|
|
}({}));
|
|
|
|
|
issueTrackers.push(trelloFunctions);
|
|
|
|
|
|
2015-12-29 16:20:36 +01:00
|
|
|
var mingleFunctions = (function(module) {
|
2016-04-21 12:31:38 +02:00
|
|
|
module.name = "mingle";
|
2015-12-29 16:20:36 +01:00
|
|
|
|
|
|
|
|
module.isEligible = function(){
|
|
|
|
|
return /.*mingle.thoughtworks.com\/.*/g.test(document.URL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.getSelectedIssueKeyList = function() {
|
|
|
|
|
//Bord View - /projects/<project_name>/cards/grid
|
|
|
|
|
if (/.*\/projects\/[^/]*\/cards\/grid(\?.*)?/g.test(document.URL)) {
|
|
|
|
|
var project = document.URL.match(/.*\/projects\/([^/]*).*/)[1];
|
|
|
|
|
var number = $(document).find('#card_show_lightbox_content > div > form[data-card-number]').attr('data-card-number');
|
|
|
|
|
return [project + "-" + number];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Card View - /projects/<project_name>/cards/<card_number>
|
|
|
|
|
if (/.*\/projects\/[^/]*\/cards\/\d+(\?.*)?/g.test(document.URL)) {
|
|
|
|
|
var project = document.URL.match(/.*\/projects\/([^/]*).*/)[1];
|
|
|
|
|
var number = document.URL.match(/.*\/projects\/[^/]*\/cards\/(\d+)(\?.*)?/)[1];
|
|
|
|
|
return [project + "-" + number];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return [];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.getCardData = function(issueKey, callback) {
|
|
|
|
|
var promises = [];
|
|
|
|
|
var issueData = {};
|
|
|
|
|
|
|
|
|
|
promises.push(module.getIssueData(issueKey).then(function(data) {
|
|
|
|
|
data = $(data.documentElement)
|
|
|
|
|
|
|
|
|
|
issueData.key = data.find('card > number')[0].textContent;
|
|
|
|
|
issueData.type = data.find('card > card_type > name')[0].textContent.toLowerCase();
|
|
|
|
|
issueData.summary = data.find('card > name')[0].textContent;
|
|
|
|
|
issueData.description = data.find('card > description')[0].innerHTML; // TODO use data.find('card > rendered_description')[0].attr('url');
|
|
|
|
|
|
|
|
|
|
if(data.find('card > properties > property > name:contains(Owner) ~ value > name').length > 0){
|
|
|
|
|
issueData.assignee = data.find('card > properties > property > name:contains(Owner) ~ value > name')[0].textContent;
|
|
|
|
|
// TODOissueData.avatarUrl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// n/a issueData.dueDate = formatDate(new Date(dueDate));
|
|
|
|
|
// n/a issueData.hasAttachment = data.fields.attachment.length > 0;
|
|
|
|
|
|
|
|
|
|
if(data.find('card > properties > property > name:contains(Estimate) ~ value').length > 0){
|
2016-05-23 09:19:34 +02:00
|
|
|
issueData.estimate = data.find('card > properties > property > name:contains(Estimate) ~ value')[0].textContent;
|
2015-12-29 16:20:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// n/a issueData.superIssue
|
|
|
|
|
|
|
|
|
|
var projectIdentifier = data.find('card > project > identifier')[0].textContent;
|
|
|
|
|
var cardNumber = data.find('card > number')[0].textContent
|
|
|
|
|
issueData.url = "https://" + document.location.hostname + "/projects/" + projectIdentifier + "/cards/" + cardNumber;
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
return Promise.all(promises).then(function(results){return issueData;});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.getIssueData = function(issueKey) {
|
|
|
|
|
var issueKeySplit = issueKey.split('-');
|
|
|
|
|
var project = issueKeySplit[0];
|
|
|
|
|
var number = issueKeySplit[1];
|
|
|
|
|
var url = "/api/v2/projects/" + project + "/cards/" + number + ".xml";
|
|
|
|
|
console.log("IssueUrl: " + url);
|
|
|
|
|
//console.log("Issue: " + issueKey + " Loading...");
|
|
|
|
|
return httpGet(url);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return module;
|
|
|
|
|
}({}));
|
|
|
|
|
issueTrackers.push(mingleFunctions);
|
|
|
|
|
|
2015-12-29 11:50:41 +01:00
|
|
|
return issueTrackers;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
//############################################################################################################################
|
|
|
|
|
//############################################################################################################################
|
|
|
|
|
//############################################################################################################################
|
|
|
|
|
|
|
|
|
|
function initGoogleAnalytics() {
|
2016-08-29 16:38:01 +02:00
|
|
|
// if (global.isDev) {
|
|
|
|
|
// this.ga = function(){ console.log("GoogleAnalytics: " + Object.keys(arguments).map(key => arguments[key]))}
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// // <GoogleAnalytics>
|
|
|
|
|
// (function(i, s, o, g, r, a, m) {
|
|
|
|
|
// i['GoogleAnalyticsObject'] = r;
|
|
|
|
|
// i[r] = i[r] || function() {
|
|
|
|
|
// (i[r].q = i[r].q || []).push(arguments)
|
|
|
|
|
// }, i[r].l = 1 * new Date();
|
|
|
|
|
// a = s.createElement(o),
|
|
|
|
|
// m = s.getElementsByTagName(o)[0];
|
|
|
|
|
// a.async = 1;
|
|
|
|
|
// a.src = g;
|
|
|
|
|
// m.parentNode.insertBefore(a, m)
|
|
|
|
|
// })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
|
|
|
|
|
//
|
|
|
|
|
// ga('create', 'UA-50840116-3', {
|
|
|
|
|
// 'alwaysSendReferrer': true
|
|
|
|
|
// });
|
|
|
|
|
// ga('set', 'page', '/cardprinter');
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//############################################################################################################################
|
|
|
|
|
//############################################################################################################################
|
|
|
|
|
//############################################################################################################################
|
|
|
|
|
|
2015-11-27 15:02:05 +01:00
|
|
|
function parseBool(text, def){
|
|
|
|
|
if(text == 'true') return true;
|
|
|
|
|
else if ( text == 'false') return false;
|
|
|
|
|
else return def;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function appendScript(url, callback) {
|
|
|
|
|
|
|
|
|
|
var head = document.getElementsByTagName('head')[0];
|
|
|
|
|
var script = document.createElement('script');
|
|
|
|
|
script.src = url;
|
|
|
|
|
|
|
|
|
|
// Then bind the event to the callback function.
|
|
|
|
|
// There are several events for cross browser compatibility.
|
|
|
|
|
script.onreadystatechange = callback;
|
|
|
|
|
script.onload = callback;
|
|
|
|
|
|
|
|
|
|
head.appendChild(script);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function readCookie(name) {
|
2015-06-07 13:39:29 +02:00
|
|
|
var cookies = document.cookie.split('; ');
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < cookies.length; i++) {
|
|
|
|
|
var cookie = cookies[i].split('=');
|
|
|
|
|
if (cookie[0] == name) return cookie[1];
|
2015-05-30 01:34:05 +02:00
|
|
|
}
|
2015-11-27 15:02:05 +01:00
|
|
|
return null;
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function writeCookie(name, value) {
|
2015-12-28 16:42:54 +01:00
|
|
|
var expireDate = new Date(); // current date & time
|
|
|
|
|
expireDate.setFullYear(expireDate.getFullYear() + 1) // one year
|
|
|
|
|
document.cookie = name + "=" + value + "; path=/; expires=" + expireDate.toGMTString();
|
|
|
|
|
|
|
|
|
|
// cleanup due to former path
|
|
|
|
|
document.cookie = name + "=; expires=" + new Date(0).toGMTString();
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
2015-11-27 15:02:05 +01:00
|
|
|
|
2015-12-17 10:14:38 +01:00
|
|
|
function httpGetCORS(){
|
2015-12-18 06:52:59 +01:00
|
|
|
//arguments[0] = 'https://jsonp.afeld.me/?url=' + arguments[0];
|
2015-12-17 10:34:25 +01:00
|
|
|
//arguments[0] = 'http://cors.io/?u=' + arguments[0];
|
2015-12-18 06:52:59 +01:00
|
|
|
arguments[0] = 'https://crossorigin.me/' + arguments[0];
|
2015-12-17 10:14:38 +01:00
|
|
|
return httpGet.apply(this, arguments);
|
2015-11-27 15:02:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function httpGet(){
|
2015-12-27 22:51:13 +01:00
|
|
|
return Promise.resolve($.get.apply(this, arguments));
|
2015-11-27 15:02:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function httpGetJSON(){
|
2015-12-27 22:51:13 +01:00
|
|
|
return Promise.resolve($.getJSON.apply(this, arguments));
|
2015-11-27 15:02:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function resizeIframe(iframe) {
|
2015-12-27 22:51:13 +01:00
|
|
|
iframe = $(iframe);
|
2015-11-27 15:02:05 +01:00
|
|
|
iframe.height(iframe[0].contentWindow.document.body.height);
|
|
|
|
|
}
|
2015-06-07 13:39:29 +02:00
|
|
|
|
|
|
|
|
function addStringFunctions() {
|
|
|
|
|
|
|
|
|
|
//trim string - remove leading and trailing whitespaces
|
|
|
|
|
if (!String.prototype.trim) {
|
|
|
|
|
String.prototype.trim = function() {
|
|
|
|
|
return this.replace(/^\s+|\s+$/g, '');
|
|
|
|
|
};
|
2015-05-30 01:34:05 +02:00
|
|
|
}
|
2015-06-07 13:39:29 +02:00
|
|
|
|
|
|
|
|
if (!String.prototype.startsWith) {
|
|
|
|
|
String.prototype.startsWith = function(str) {
|
|
|
|
|
return this.slice(0, str.length) == str;
|
|
|
|
|
};
|
2015-05-30 01:34:05 +02:00
|
|
|
}
|
2015-05-31 21:55:14 +02:00
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
if (!String.prototype.endsWith) {
|
|
|
|
|
String.prototype.endsWith = function(str) {
|
|
|
|
|
return this.slice(-str.length) == str;
|
|
|
|
|
};
|
2015-05-30 01:34:05 +02:00
|
|
|
}
|
2015-06-07 13:39:29 +02:00
|
|
|
|
|
|
|
|
if (!String.prototype.toCamelCase) {
|
|
|
|
|
String.prototype.toCamelCase = function() {
|
|
|
|
|
// remove all characters that should not be in a variable name
|
|
|
|
|
// as well underscores an numbers from the beginning of the string
|
|
|
|
|
var s = this.replace(/([^a-zA-Z0-9_\- ])|^[_0-9]+/g, "").trim().toLowerCase();
|
|
|
|
|
// uppercase letters preceeded by a hyphen or a space
|
|
|
|
|
s = s.replace(/([ -]+)([a-zA-Z0-9])/g, function(a, b, c) {
|
|
|
|
|
return c.toUpperCase();
|
|
|
|
|
});
|
|
|
|
|
// uppercase letters following numbers
|
|
|
|
|
s = s.replace(/([0-9]+)([a-zA-Z])/g, function(a, b, c) {
|
|
|
|
|
return b + c.toUpperCase();
|
|
|
|
|
});
|
|
|
|
|
return s;
|
|
|
|
|
}
|
2015-05-30 01:34:05 +02:00
|
|
|
}
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
|
|
|
|
|
2015-11-27 15:02:05 +01:00
|
|
|
function formatDate(date) {
|
|
|
|
|
var shortMonths = {'Jan': 1, 'Feb':2, 'Mar':3, 'Apr':4, 'May':5, 'Jun':6, 'Jul':7, 'Aug':8, 'Sep':9, 'Oct':10, 'Nov':11, 'Dec':12 };
|
|
|
|
|
var dateSplit = date.toString().split(" ");
|
|
|
|
|
// Mo 28.11.
|
|
|
|
|
return dateSplit[0] + " " + dateSplit[2] + "." + shortMonths[dateSplit[1]] + ".";
|
2015-06-07 13:39:29 +02:00
|
|
|
}
|
|
|
|
|
|
2015-12-29 11:50:41 +01:00
|
|
|
function multilineString(commentFunction) {
|
|
|
|
|
return commentFunction.toString()
|
|
|
|
|
.replace(/^[^\/]+\/\*!?/, '')
|
|
|
|
|
.replace(/\*\/[^\/]+$/, '');
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-07 13:39:29 +02:00
|
|
|
//############################################################################################################################
|
2015-12-29 11:50:41 +01:00
|
|
|
// Resources
|
2015-06-07 13:39:29 +02:00
|
|
|
//############################################################################################################################
|
2015-12-29 11:50:41 +01:00
|
|
|
function getResources(){
|
|
|
|
|
var resources = {};
|
|
|
|
|
resources.cardHtml = multilineString(function(){/*
|
|
|
|
|
<div class="card">
|
|
|
|
|
<div class="card-content">
|
|
|
|
|
<div class="card-body shadow">
|
|
|
|
|
<div class="issue-summary"></div>
|
|
|
|
|
<div class="issue-description"></div>
|
2016-08-30 15:41:19 +02:00
|
|
|
<div class="issue-external-id"></div>
|
2015-12-29 11:50:41 +01:00
|
|
|
</div>
|
|
|
|
|
<div class="card-header">
|
|
|
|
|
<div class="author">
|
|
|
|
|
<span>qoomon.com</span>
|
|
|
|
|
<br>
|
|
|
|
|
<span>©BengtBrodersen</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="issue-id badge"></div>
|
|
|
|
|
<div class="issue-id-fadeout"></div>
|
|
|
|
|
<div class="issue-icon badge" type="loading"></div>
|
|
|
|
|
<div class="issue-estimate badge"></div>
|
|
|
|
|
<div class="issue-due-box">
|
|
|
|
|
<div class="issue-due-date badge"></div>
|
|
|
|
|
<div class="issue-due-icon badge"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="card-footer">
|
2016-08-30 16:49:11 +02:00
|
|
|
<div class="issue-sdp-number badge"></div>
|
|
|
|
|
<div class="issue-qr-code badge"></div>
|
2015-12-29 11:50:41 +01:00
|
|
|
<div class="issue-attachment badge"></div>
|
|
|
|
|
<div class="issue-assignee badge"></div>
|
|
|
|
|
<div class="issue-epic-box badge">
|
|
|
|
|
<span class="issue-epic-id"></span><br>
|
|
|
|
|
<span class="issue-epic-name"></span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
*/});
|
|
|
|
|
resources.cardCss = multilineString(function(){/*
|
|
|
|
|
* {
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
html {
|
|
|
|
|
background-color: LIGHTGREY;
|
|
|
|
|
padding: 0rem;
|
|
|
|
|
margin: 1rem;
|
|
|
|
|
font-size: 1.0cm;
|
|
|
|
|
overflow-y: scroll;
|
|
|
|
|
}
|
|
|
|
|
body {
|
|
|
|
|
padding: 0rem;
|
|
|
|
|
margin: 0rem;
|
|
|
|
|
max-height: 100%;
|
|
|
|
|
max-width: 100%;
|
|
|
|
|
overflow: visible;
|
|
|
|
|
}
|
|
|
|
|
.badge, .shadow {
|
|
|
|
|
border-style: solid;
|
|
|
|
|
border-color: #454545;
|
|
|
|
|
border-top-width: 0.12rem;
|
|
|
|
|
border-left-width: 0.12rem;
|
|
|
|
|
border-bottom-width: 0.21rem;
|
|
|
|
|
border-right-width: 0.21rem;
|
|
|
|
|
border-radius: 0.25rem;
|
|
|
|
|
}
|
|
|
|
|
.badge {
|
|
|
|
|
background-color: WHITESMOKE;
|
|
|
|
|
}
|
|
|
|
|
.hidden {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
.zigzag {
|
|
|
|
|
border-bottom-width: 0rem;
|
|
|
|
|
}
|
|
|
|
|
.zigzag::after {
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
position: absolute;
|
|
|
|
|
bottom: 0.00rem;
|
|
|
|
|
left: 0.0rem;
|
|
|
|
|
content: "";
|
|
|
|
|
width: 100%;
|
|
|
|
|
border-style: solid;
|
|
|
|
|
border-bottom-width: 0.5rem;
|
2016-08-30 11:26:22 +02:00
|
|
|
border-image: url(https://static.ragnarok.yvan.hu/jira-card-printer/resources/Tearing.png);
|
2015-12-29 11:50:41 +01:00
|
|
|
border-image-width: 0 0 0.7rem 0;
|
|
|
|
|
border-image-slice: 56 0 56 1;
|
|
|
|
|
border-image-repeat: round round;
|
|
|
|
|
}
|
|
|
|
|
#preload {
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 0rem;
|
|
|
|
|
left: 100%;
|
|
|
|
|
}
|
|
|
|
|
.author {
|
|
|
|
|
color: DIMGREY;
|
|
|
|
|
position: relative;
|
|
|
|
|
top: 0.2rem;
|
|
|
|
|
left: calc(50% - 2rem);
|
|
|
|
|
font-size: 0.8rem;
|
|
|
|
|
overflow: visible;
|
|
|
|
|
line-height: 0.38rem;
|
2016-08-30 15:41:19 +02:00
|
|
|
display: none;
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
|
|
|
|
.author > span:nth-of-type(2) {
|
|
|
|
|
position: relative;
|
|
|
|
|
top: 0.1rem;
|
|
|
|
|
left: 0.65rem;
|
|
|
|
|
font-size: 0.5em;
|
|
|
|
|
}
|
|
|
|
|
.card {
|
|
|
|
|
position: relative;
|
|
|
|
|
float: left;
|
|
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding: 0.5rem;
|
|
|
|
|
min-width: 14.5rem;
|
|
|
|
|
min-height: 8.65rem;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
background-color: WHITE;
|
|
|
|
|
}
|
|
|
|
|
.card::before {
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
overflow: visible;
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0.0rem;
|
|
|
|
|
left: 0.0rem;
|
|
|
|
|
content: "";
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
border-color: LightGray;
|
|
|
|
|
border-style: dashed;
|
|
|
|
|
border-width: 0.03cm;
|
|
|
|
|
}
|
|
|
|
|
.card-content {
|
|
|
|
|
position: relative;
|
|
|
|
|
height: 100%;
|
|
|
|
|
// find .card-header;
|
|
|
|
|
padding-top: 2rem;
|
|
|
|
|
// find .card-footer;
|
|
|
|
|
padding-bottom: 1.3rem;
|
|
|
|
|
}
|
|
|
|
|
.card-body {
|
|
|
|
|
position: relative;
|
|
|
|
|
height: 100%;
|
|
|
|
|
margin-left: 0.4rem;
|
|
|
|
|
margin-right: 0.4rem;
|
|
|
|
|
padding-top: 1.1rem;
|
|
|
|
|
padding-bottom: 1.1rem;
|
|
|
|
|
padding-left: 0.4rem;
|
|
|
|
|
padding-right: 0.4rem;
|
|
|
|
|
background: WHITE;
|
|
|
|
|
}
|
|
|
|
|
.card-header {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0rem;
|
|
|
|
|
height: 4.2rem;
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
.card-footer {
|
|
|
|
|
position: absolute;
|
|
|
|
|
bottom: 0rem;
|
|
|
|
|
height: 2.2rem;
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
.issue-summary {
|
|
|
|
|
font-weight: bold;
|
2016-08-30 16:49:11 +02:00
|
|
|
font-size: 1.4rem;
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
2016-08-30 15:41:19 +02:00
|
|
|
.issue-external-id {
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
font-size: 2.5rem;
|
|
|
|
|
display: block;
|
|
|
|
|
position: absolute;
|
|
|
|
|
bottom: 0.5rem;
|
|
|
|
|
left: 2.8rem;
|
|
|
|
|
}
|
2015-12-29 11:50:41 +01:00
|
|
|
.issue-description {
|
|
|
|
|
margin-top: 0.1rem;
|
|
|
|
|
display: block;
|
|
|
|
|
font-size: 0.6rem;
|
|
|
|
|
line-height: 0.62rem;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
.issue-description p:first-of-type {
|
|
|
|
|
margin-top: 0rem;
|
|
|
|
|
}
|
|
|
|
|
.issue-description p:last-of-type {
|
|
|
|
|
margin-bottom: 0rem;
|
|
|
|
|
}
|
|
|
|
|
.issue-id {
|
|
|
|
|
position: absolute;
|
2016-08-30 15:41:19 +02:00
|
|
|
left: 2rem;
|
2015-12-29 11:50:41 +01:00
|
|
|
top: 1.2rem;
|
|
|
|
|
height: 1.5rem;
|
2016-08-30 15:41:19 +02:00
|
|
|
max-width: calc(100% - 5.5rem);
|
2015-12-29 11:50:41 +01:00
|
|
|
min-width: 6.0rem;
|
|
|
|
|
padding-left: 2.1rem;
|
|
|
|
|
padding-right: 0.4rem;
|
|
|
|
|
background-color: WHITESMOKE;
|
|
|
|
|
line-height: 1.3rem;
|
2016-08-30 15:41:19 +02:00
|
|
|
font-size: 1.2rem;
|
2015-12-29 11:50:41 +01:00
|
|
|
font-weight: bold;
|
|
|
|
|
text-align: center;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
direction: rtl;
|
|
|
|
|
}
|
|
|
|
|
.issue-id-fadeout {
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 2.4rem;
|
|
|
|
|
top: 1.3rem;
|
|
|
|
|
width: 1.2rem;
|
|
|
|
|
height: 1.2rem;
|
|
|
|
|
z-index: 0;
|
|
|
|
|
background: linear-gradient(to left, rgba(224, 224, 224, 0) 0%, rgba(224, 224, 224, 1) 60%);
|
|
|
|
|
}
|
|
|
|
|
.issue-icon {
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 0rem;
|
|
|
|
|
top: 0rem;
|
|
|
|
|
height: 3.0rem;
|
|
|
|
|
width: 3.0rem;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
background-color: LIGHTSEAGREEN;
|
2016-08-30 11:26:22 +02:00
|
|
|
background-image: url(https://static.ragnarok.yvan.hu/jira-card-printer/resources/icons/Objects.png);
|
2015-12-29 11:50:41 +01:00
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
background-position: center;
|
|
|
|
|
background-size: 63%;
|
|
|
|
|
}
|
|
|
|
|
.issue-icon[type="loading"]{
|
|
|
|
|
background-color: DEEPSKYBLUE;
|
2016-08-30 11:26:22 +02:00
|
|
|
background-image: url(https://static.ragnarok.yvan.hu/jira-card-printer/resources/icons/CloudLoading.png);
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
|
|
|
|
.issue-icon[type="story"], .issue-icon[type="user story"] {
|
|
|
|
|
background-color: GOLD;
|
2016-08-30 11:26:22 +02:00
|
|
|
background-image: url(https://static.ragnarok.yvan.hu/jira-card-printer/resources/icons/Bulb.png);
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
2016-05-03 23:04:26 +02:00
|
|
|
.issue-icon[type="bug"], .issue-icon[type="problem"], .issue-icon[type="correction"] {
|
2015-12-29 11:50:41 +01:00
|
|
|
background-color: CRIMSON;
|
2016-08-30 11:26:22 +02:00
|
|
|
background-image: url(https://static.ragnarok.yvan.hu/jira-card-printer/resources/icons/Bug.png);
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
|
|
|
|
.issue-icon[type="epic"] {
|
|
|
|
|
background-color: ROYALBLUE;
|
2016-08-30 11:26:22 +02:00
|
|
|
background-image: url(https://static.ragnarok.yvan.hu/jira-card-printer/resources/icons/Flash.png);
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
2016-05-03 23:04:26 +02:00
|
|
|
.issue-icon[type="task"], .issue-icon[type="sub-task"], .issue-icon[type="technical task"],
|
2015-12-29 11:50:41 +01:00
|
|
|
.issue-icon[type="aufgabe"], .issue-icon[type="unteraufgabe"], .issue-icon[type="technische aufgabe"] {
|
|
|
|
|
background-color: WHEAT;
|
2016-08-30 11:26:22 +02:00
|
|
|
background-image: url(https://static.ragnarok.yvan.hu/jira-card-printer/resources/icons/Task.png);
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
|
|
|
|
.issue-icon[type="new feature"] {
|
|
|
|
|
background-color: LIMEGREEN;
|
2016-08-30 11:26:22 +02:00
|
|
|
background-image: url(https://static.ragnarok.yvan.hu/jira-card-printer/resources/icons/Plus.png);
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
|
|
|
|
.issue-icon[type="improvement"],
|
|
|
|
|
.issue-icon[type="verbesserung"] {
|
|
|
|
|
background-color: CORNFLOWERBLUE;
|
2016-08-30 11:26:22 +02:00
|
|
|
background-image: url(https://static.ragnarok.yvan.hu/jira-card-printer/resources/icons/Arrow.png);
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
|
|
|
|
.issue-icon[type="research"] {
|
|
|
|
|
background-color: MEDIUMTURQUOISE;
|
2016-08-30 11:26:22 +02:00
|
|
|
background-image: url(https://static.ragnarok.yvan.hu/jira-card-printer/resources/icons/ErlenmeyerFlask.png);
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
2016-05-03 23:04:26 +02:00
|
|
|
.issue-icon[type="test"] {
|
|
|
|
|
background-color: ORANGE;
|
2016-08-30 11:26:22 +02:00
|
|
|
background-image: url(https://static.ragnarok.yvan.hu/jira-card-printer/resources/icons/CrashDummy.png);
|
2016-05-03 23:04:26 +02:00
|
|
|
}
|
2015-12-29 11:50:41 +01:00
|
|
|
.issue-estimate {
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 2.5rem;
|
|
|
|
|
top: 0.0rem;
|
|
|
|
|
height: 1.6rem;
|
|
|
|
|
width: 1.6rem;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
background-color: WHITESMOKE;
|
|
|
|
|
line-height: 1.4rem;
|
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
.issue-qr-code {
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 0rem;
|
|
|
|
|
top: 0rem;
|
|
|
|
|
width: 2.2rem;
|
|
|
|
|
height: 2.2rem;
|
|
|
|
|
background-image: url(https://chart.googleapis.com/chart?cht=qr&chs=256x256&chld=L|1&chl=blog.qoomon.com);
|
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
background-size: cover;
|
|
|
|
|
background-position: center;
|
|
|
|
|
}
|
2016-08-30 16:49:11 +02:00
|
|
|
.issue-sdp-number {
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 0rem;
|
|
|
|
|
top: 0rem;
|
2016-08-30 17:01:25 +02:00
|
|
|
padding-left: 0.2rem;
|
|
|
|
|
padding-right: 0.2rem;
|
2016-08-30 16:49:11 +02:00
|
|
|
}
|
2015-12-29 11:50:41 +01:00
|
|
|
.issue-attachment {
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 2.5rem;
|
|
|
|
|
top: 0rem;
|
|
|
|
|
width: 2.0rem;
|
|
|
|
|
height: 2.0rem;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
background-color: LIGHTSKYBLUE;
|
2016-08-30 11:26:22 +02:00
|
|
|
background-image: url(https://static.ragnarok.yvan.hu/jira-card-printer/resources/icons/Attachment.png);
|
2015-12-29 11:50:41 +01:00
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
background-position: center;
|
|
|
|
|
background-size: 70%;
|
2016-08-30 17:01:25 +02:00
|
|
|
display: none;
|
2015-12-29 11:50:41 +01:00
|
|
|
}
|
|
|
|
|
.issue-assignee {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0rem;
|
|
|
|
|
right: 0rem;
|
|
|
|
|
width: 2.2rem;
|
|
|
|
|
height: 2.2rem;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
background-color: WHITESMOKE;
|
|
|
|
|
background-image: url(https://www.colourbox.com/preview/10714847-evil-christmas-elf.jpg);
|
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
background-position: center;
|
|
|
|
|
background-size: cover;
|
|
|
|
|
//-webkit-filter: contrast(200%) grayscale(100%);
|
|
|
|
|
//filter: contrast(200%) grayscale(100%);
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
font-size: 1.4rem;
|
|
|
|
|
line-height: 1.9rem;
|
|
|
|
|
}
|
|
|
|
|
.issue-epic-box {
|
|
|
|
|
position: absolute;
|
|
|
|
|
right: 2.5rem;
|
|
|
|
|
top: 0rem;
|
|
|
|
|
width: auto;
|
|
|
|
|
min-width: 2rem;
|
|
|
|
|
width: auto;
|
|
|
|
|
max-width: calc(100% - 7.5rem);
|
|
|
|
|
height: auto;
|
|
|
|
|
max-height: 2.2rem;
|
|
|
|
|
padding-top: 0.1rem;
|
|
|
|
|
padding-bottom: 0.2rem;
|
|
|
|
|
padding-left: 0.3rem;
|
|
|
|
|
padding-right: 0.3rem;
|
|
|
|
|
text-align: left;
|
|
|
|
|
font-size: 0.5rem;
|
|
|
|
|
line-height: 0.55rem;
|
|
|
|
|
}
|
|
|
|
|
.issue-epic-id {
|
|
|
|
|
font-size: 0.6rem;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
max-width: 1rem;
|
|
|
|
|
}
|
|
|
|
|
.issue-epic-name {
|
|
|
|
|
font-size: 0.55rem;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
|
|
|
|
.issue-due-date-box {
|
|
|
|
|
position: absolute;
|
|
|
|
|
right: 0rem;
|
|
|
|
|
top: 0rem;
|
|
|
|
|
overflow: visible !important;
|
|
|
|
|
}
|
|
|
|
|
.issue-due-date {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 1.3rem;
|
|
|
|
|
right: 1rem;
|
|
|
|
|
width: 5.3rem;
|
|
|
|
|
height: 1.3rem;
|
|
|
|
|
padding-left: 0.2rem;
|
|
|
|
|
padding-right: 1.4rem;
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
font-size: 0.7rem;
|
|
|
|
|
line-height: 1.0rem;
|
|
|
|
|
}
|
|
|
|
|
.issue-due-icon {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0.5rem;
|
|
|
|
|
right: 0rem;
|
|
|
|
|
width: 2.5rem;
|
|
|
|
|
height: 2.5rem;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
background-color: ORCHID;
|
2016-08-30 11:26:22 +02:00
|
|
|
background-image: url(https://static.ragnarok.yvan.hu/jira-card-printer/resources/icons/AlarmClock.png);
|
2015-12-29 11:50:41 +01:00
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
background-position: center;
|
|
|
|
|
background-size: 65%;
|
|
|
|
|
}
|
|
|
|
|
@media print {
|
|
|
|
|
@page {
|
|
|
|
|
margin: 0.0mm;
|
|
|
|
|
padding: 0.0mm;
|
|
|
|
|
}
|
|
|
|
|
html {
|
|
|
|
|
margin: 0.0mm;
|
|
|
|
|
padding: 0.0mm;
|
|
|
|
|
background-color: WHITE !important;
|
|
|
|
|
-webkit-print-color-adjust: exact !important;
|
|
|
|
|
print-color-adjust: exact !important;
|
|
|
|
|
}
|
|
|
|
|
.card {
|
|
|
|
|
page-break-inside: avoid !important;
|
|
|
|
|
margin: 0.0mm !important;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*/});
|
|
|
|
|
resources.printPreviewHtml = multilineString(function(){/*
|
|
|
|
|
<div id="card-print-overlay">
|
|
|
|
|
<div id="card-print-dialog">
|
|
|
|
|
<div id="card-print-dialog-header">
|
|
|
|
|
<div id="card-print-dialog-title">Card Printer</div>
|
|
|
|
|
<div id="info">
|
|
|
|
|
<label id="info-line"><b>Jira</b> - <b>Trello</b> - <b>YouTrack</b> - <b>PivotalTracker</b></label>
|
|
|
|
|
<div id="report-issue" class="ui-element button" >Report Issues</div>
|
|
|
|
|
<div id="about" class="ui-element button" >About</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="card-print-dialog-content">
|
|
|
|
|
<iframe id="card-print-dialog-content-iframe"></iframe>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="card-print-dialog-footer">
|
|
|
|
|
<div class="buttons">
|
|
|
|
|
<div class="ui-element" style="float: left;" >
|
|
|
|
|
<input id="columnCount" type="number" min="0" max="9" class="numberInput" style="float: left; width: 18px; padding: 2px;" value="1"/>
|
|
|
|
|
<div style="float: left; margin-left: 5px; margin-right: 5px;">x</div>
|
|
|
|
|
<input id="rowCount" type="number" min="0" max="9" class="numberInput" style="float: left; width: 18px; padding: 2px;" value="2"/>
|
|
|
|
|
<label style="float: left; margin-left:5px;">Page Grid</label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="ui-element" style="float: left;">
|
|
|
|
|
<form style="float: left;" oninput="amount.value=parseFloat(scaleRange.value).toFixed(1)">
|
|
|
|
|
<input id="scaleRange" type="range" min="-1.0" max="1.0" step="0.1" value="0.0" style="float: left; width: 70px; position: relative;
|
|
|
|
|
top: -2px;" />
|
|
|
|
|
<label>Scale</label>
|
|
|
|
|
<output style="float: left; width: 22px; margin-left:2px;" name="amount" for="scaleRange"></output>
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<div class="ui-element checkbox" style="float: left;">
|
|
|
|
|
<input id="single-card-page-checkbox" type="checkbox"/>
|
|
|
|
|
<label for="single-card-page-checkbox"></label>
|
|
|
|
|
<label for="single-card-page-checkbox">Single Card Per Page</label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="ui-element checkbox" style="float: left;">
|
|
|
|
|
<input id="description-checkbox" type="checkbox"/>
|
|
|
|
|
<label for="description-checkbox"></label>
|
|
|
|
|
<label for="description-checkbo">Description</label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="ui-element checkbox" style="float: left;">
|
|
|
|
|
<input id="assignee-checkbox" type="checkbox"/>
|
|
|
|
|
<label for="assignee-checkbox"></label>
|
|
|
|
|
<label for="assignee-checkbox">Assignee</label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="ui-element checkbox" style="float: left;">
|
|
|
|
|
<input id="due-date-checkbox" type="checkbox"/>
|
|
|
|
|
<label for="due-date-checkbox"></label>
|
|
|
|
|
<label for="due-date-checkbox">Due Date</label>
|
|
|
|
|
</div>
|
2016-05-23 09:19:34 +02:00
|
|
|
<div class="ui-element checkbox" style="float: left;">
|
|
|
|
|
<input id="estimate-checkbox" type="checkbox"/>
|
|
|
|
|
<label for="estimate-checkbox"></label>
|
|
|
|
|
<label for="estimate-checkbox">Estimate</label>
|
|
|
|
|
</div>
|
2015-12-29 11:50:41 +01:00
|
|
|
<div class="ui-element checkbox" style="float: left;">
|
|
|
|
|
<input id="qr-code-checkbox" type="checkbox"/>
|
|
|
|
|
<label for="qr-code-checkbox"></label>
|
|
|
|
|
<label for="qr-code-checkbox">QR Code</label>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id="card-print-dialog-print" class="ui-element button button-primary" >Print</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
*/});
|
|
|
|
|
resources.printPreviewCss = multilineString(function(){/*
|
|
|
|
|
* {
|
|
|
|
|
font-family: Arial, sans-serif;
|
|
|
|
|
color: #656565;
|
|
|
|
|
}
|
|
|
|
|
#card-print-overlay {
|
|
|
|
|
position: fixed;
|
|
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
background: rgba(0, 0, 0, 0.5);
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
word-wrap: break-word;
|
|
|
|
|
z-index: 99999;
|
|
|
|
|
}
|
|
|
|
|
#card-print-dialog {
|
|
|
|
|
position: relative;
|
|
|
|
|
top: 60px;
|
|
|
|
|
right: 0px;
|
|
|
|
|
left: 0px;
|
|
|
|
|
height: calc(100% - 120px);
|
|
|
|
|
width: 1000px;
|
|
|
|
|
margin: auto;
|
|
|
|
|
border-style: solid;
|
|
|
|
|
border-color: #cccccc;
|
|
|
|
|
border-width: 1px;
|
|
|
|
|
-webkit-border-radius: 4px;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
#card-print-dialog-header {
|
|
|
|
|
position: relative;
|
|
|
|
|
background: #f0f0f0;
|
|
|
|
|
height: 25px;
|
|
|
|
|
border-bottom: 1px solid #cccccc;
|
|
|
|
|
padding: 10px 15px 15px 15px;
|
|
|
|
|
}
|
|
|
|
|
#card-print-dialog-content {
|
|
|
|
|
position: relative;
|
|
|
|
|
background: white;
|
|
|
|
|
height: calc(100% - 106px);
|
|
|
|
|
width: 100%;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
#card-print-dialog-content-iframe {
|
|
|
|
|
position: relative;
|
|
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
border: none;
|
|
|
|
|
}
|
|
|
|
|
#card-print-dialog-footer {
|
|
|
|
|
position: relative;
|
|
|
|
|
background: #f0f0f0;
|
|
|
|
|
border-top: 1px solid #cccccc;
|
|
|
|
|
height: 30px;
|
|
|
|
|
padding: 15px 15px 10px 15px;
|
|
|
|
|
text-align: right;
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
}
|
|
|
|
|
#buttons {
|
|
|
|
|
position: relative;
|
|
|
|
|
float: right;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
height 30px;
|
|
|
|
|
}
|
|
|
|
|
#info {
|
|
|
|
|
position: relative;
|
|
|
|
|
float: right;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
height: 30px;
|
|
|
|
|
}
|
|
|
|
|
#info-line {
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
line-height: 29px;
|
|
|
|
|
margin-right: 8.4rem;
|
|
|
|
|
}
|
|
|
|
|
#card-print-dialog-title {
|
|
|
|
|
position: relative;
|
|
|
|
|
float: left;
|
|
|
|
|
color: rgb(51, 51, 51);
|
|
|
|
|
display: block;
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
font-weight: normal;
|
|
|
|
|
height: 30px;
|
|
|
|
|
line-height: 30px;
|
|
|
|
|
}
|
|
|
|
|
.ui-element {
|
|
|
|
|
color: #656565;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
margin: 5px 5px;
|
|
|
|
|
vertical-align: baseline;
|
|
|
|
|
}
|
|
|
|
|
.button {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
background-color: #DEDEDE;
|
|
|
|
|
border: 1px solid #D4D4D4;
|
|
|
|
|
border-radius: 3px;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
padding: 5.8px 20px;
|
|
|
|
|
margin: 0px 2px;
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
.button-primary{
|
|
|
|
|
background-color: #5689db;
|
|
|
|
|
border: 1px solid #5689db;
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
label {
|
|
|
|
|
display: block;
|
|
|
|
|
margin-left: 5px;
|
|
|
|
|
float:left;
|
|
|
|
|
}
|
|
|
|
|
label[for] {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
.checkbox {
|
|
|
|
|
position: relative;
|
|
|
|
|
width: auto;
|
|
|
|
|
height: auto;
|
|
|
|
|
}
|
|
|
|
|
.checkbox input[type=checkbox]{
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
.checkbox input[type=checkbox] + label {
|
|
|
|
|
margin: 0px;
|
|
|
|
|
position: relative;
|
|
|
|
|
width: 15px;
|
|
|
|
|
height: 15px;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
background-color: #DEDEDE;
|
|
|
|
|
border: 1px solid #D4D4D4;
|
|
|
|
|
}
|
|
|
|
|
.checkbox input[type=checkbox] + label::after {
|
|
|
|
|
opacity: 0;
|
|
|
|
|
content: '';
|
|
|
|
|
position: absolute;
|
|
|
|
|
width: 6px;
|
|
|
|
|
height: 3px;
|
|
|
|
|
background: transparent;
|
|
|
|
|
top: 4px;
|
|
|
|
|
left: 4px;
|
|
|
|
|
border: 2px solid #656565;
|
|
|
|
|
border-top: none;
|
|
|
|
|
border-right: none;
|
|
|
|
|
transform: rotate(-45deg);
|
|
|
|
|
}
|
|
|
|
|
.checkbox input[type=checkbox]:checked + label::after {
|
|
|
|
|
opacity: 1;
|
|
|
|
|
}
|
|
|
|
|
input[type=number].numberInput {
|
|
|
|
|
color: #656565;
|
|
|
|
|
position: relative;
|
|
|
|
|
top: -2;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
width:1.5em;
|
|
|
|
|
padding:3px;
|
|
|
|
|
margin:0;
|
|
|
|
|
border:1px solid #ddd;
|
|
|
|
|
border-radius:5px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
background-color: #DEDEDE;
|
|
|
|
|
border: 1px solid #D4D4D4;
|
|
|
|
|
width: 100px;
|
|
|
|
|
}
|
|
|
|
|
input[type=number].numberInput::-webkit-inner-spin-button,
|
|
|
|
|
input[type=number].numberInput ::-webkit-outer-spin-button {
|
|
|
|
|
-webkit-appearance: none;
|
|
|
|
|
}
|
|
|
|
|
input[type=number].numberInput:hover{
|
|
|
|
|
border:1px solid #ddd;
|
|
|
|
|
background-color: #f6f6f6;
|
|
|
|
|
}
|
|
|
|
|
input[type=number].numberInput:focus{
|
|
|
|
|
outline:none;
|
|
|
|
|
border:1px solid #ddd;
|
|
|
|
|
background-color: #f6f6f6;
|
|
|
|
|
}
|
|
|
|
|
*/});
|
|
|
|
|
|
|
|
|
|
return resources;
|
|
|
|
|
}
|
2015-06-07 13:39:29 +02:00
|
|
|
|
2015-05-20 08:05:08 +02:00
|
|
|
|
2015-05-15 16:27:35 +02:00
|
|
|
})();
|