fix jira namespace problem

This commit is contained in:
Bengt Brodersen 2015-05-12 22:00:40 +02:00
parent 82095c1aa3
commit 0a47b7fd1d

View File

@ -56,13 +56,13 @@
resourceOrigin = hostOrigin+ "resources/"; resourceOrigin = hostOrigin+ "resources/";
JIRA='JIRA' APP_JIRA='APP_JIRA'
PIVOTAL_TRACKER='PIVOTAL_TRACKER' APP_PIVOTAL_TRACKER='APP_PIVOTAL_TRACKER'
issueTracker = 'UNKNOWN' issueTracker = 'UNKNOWN'
if( jQuery("meta[name='application-name'][ content='JIRA']").length > 0){ if( jQuery("meta[name='application-name'][ content='JIRA']").length > 0){
issueTracker = JIRA issueTracker = APP_JIRA
} else if( /.*\pivotaltracker.com\/.*/g.test(document.URL)){ } else if( /.*\pivotaltracker.com\/.*/g.test(document.URL)){
issueTracker = PIVOTAL_TRACKER issueTracker = APP_PIVOTAL_TRACKER
} }
} }
@ -101,8 +101,15 @@
if(!isDev){ if(!isDev){
ga('send', 'event', 'button', 'click', 'print', jQuery(".card", printDocument).length ); ga('send', 'event', 'button', 'click', 'print', jQuery(".card", printDocument).length );
} }
//jQuery("html", printDocument).css("font-size", + 0.5 +"cm");
printWindow.matchMedia("print").addListener(function() { printWindow.matchMedia("print").addListener(function() {
jQuery(".page",printDocument).each(function(position, page) { jQuery(".page",printDocument).each(function(position, page) {
// jQuery(page).css("width","50%");
// jQuery(page).css("height","50%");
// jQuery(page).css("float","left");
var height = jQuery(page).height() var height = jQuery(page).height()
- jQuery(page).find(".card-header").outerHeight() - jQuery(page).find(".card-header").outerHeight()
- jQuery(page).find(".card-footer").outerHeight() - jQuery(page).find(".card-footer").outerHeight()
@ -113,8 +120,6 @@
lineHeight = lineHeight.substring(0, lineHeight.length - 2); lineHeight = lineHeight.substring(0, lineHeight.length - 2);
var lineClamp = Math.floor(height / lineHeight); var lineClamp = Math.floor(height / lineHeight);
jQuery(page).find(".description").css("-webkit-line-clamp", lineClamp+""); jQuery(page).find(".description").css("-webkit-line-clamp", lineClamp+"");
//jQuery(page).scc("float","left");
}); });
}); });
printWindow.print(); printWindow.print();
@ -197,9 +202,9 @@
function getSelectedIssueKeyList() { function getSelectedIssueKeyList() {
switch(issueTracker) { switch(issueTracker) {
case JIRA: case APP_JIRA:
return getSelectedIssueKeyListJira(); return getSelectedIssueKeyListJira();
case PIVOTAL_TRACKER: case APP_PIVOTAL_TRACKER:
return getSelectedIssueKeyListPivotalTracker(); return getSelectedIssueKeyListPivotalTracker();
} }
} }
@ -226,8 +231,6 @@
function getSelectedIssueKeyListPivotalTracker() { function getSelectedIssueKeyListPivotalTracker() {
//Single Story //Single Story
if (/.*\/stories\/.*/g.test(document.URL)) { if (/.*\/stories\/.*/g.test(document.URL)) {
return [document.URL.replace(/.*\/stories\/(.*)\??/,'$1')]; return [document.URL.replace(/.*\/stories\/(.*)\??/,'$1')];
} }
@ -243,9 +246,9 @@
function getCardData(issueKey, callback){ function getCardData(issueKey, callback){
switch(issueTracker) { switch(issueTracker) {
case JIRA: case APP_JIRA:
return getCardDataJira(issueKey, callback); return getCardDataJira(issueKey, callback);
case PIVOTAL_TRACKER: case APP_PIVOTAL_TRACKER:
return getCardDataPivotalTracker(issueKey, callback); return getCardDataPivotalTracker(issueKey, callback);
} }
@ -457,7 +460,7 @@
} }
//QR-Code //QR-Code
var qrCodeUrl = 'https://chart.googleapis.com/chart?cht=qr&chs=256x256&chld=L|1&chl=' + data.url; var qrCodeUrl = 'https://chart.googleapis.com/chart?cht=qr&chs=256x256&chld=L|1&chl=' + encodeURIComponent(data.url);
card.find(".qr-code").css("background-image", "url('" + qrCodeUrl + "')"); card.find(".qr-code").css("background-image", "url('" + qrCodeUrl + "')");
} }
@ -534,7 +537,7 @@
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;
jQuery("HTML", printDocument).css("font-size", jQuery(this).val() +"cm"); jQuery("html", printDocument).css("font-size", jQuery(this).val() +"cm");
resizeIframe(printFrame); resizeIframe(printFrame);
}); });
@ -729,8 +732,6 @@
@media print { @media print {
.page { .page {
max-height:100% ;
height: 100%;
background: white; background: white;
border-style: none; border-style: none;
padding: 0.0cm; padding: 0.0cm;