Merge branch 'develop' into gh-pages
# Conflicts: # bookmarklet.js # card.css
This commit is contained in:
commit
dc2ecb8c4f
@ -6,14 +6,14 @@
|
|||||||
// YouTrack: http://qoomon.myjetbrains.com/youtrack/dashboard
|
// YouTrack: http://qoomon.myjetbrains.com/youtrack/dashboard
|
||||||
|
|
||||||
var global = {};
|
var global = {};
|
||||||
global.version = "4.4.1";
|
global.version = "4.4.2";
|
||||||
global.issueTrackingUrl = "https://github.com/qoomon/Jira-Issue-Card-Printer";
|
global.issueTrackingUrl = "github.com/qoomon/Jira-Issue-Card-Printer";
|
||||||
|
|
||||||
global.isDev = document.currentScript == null;
|
global.isDev = document.currentScript == null;
|
||||||
|
|
||||||
// enforce jQuery
|
// enforce jQuery
|
||||||
if (typeof jQuery == 'undefined') {
|
if (typeof jQuery == 'undefined') {
|
||||||
alert("jQuery is required!\n\nPlease create an issue at " + global.issueTrackingUrl);
|
alert("jQuery is required!\n\nPlease create an issue at\n" + global.issueTrackingUrl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var $ = jQuery;
|
var $ = jQuery;
|
||||||
@ -38,6 +38,7 @@
|
|||||||
console.log("Run...")
|
console.log("Run...")
|
||||||
for (issueTracker of getIssueTrackers()) {
|
for (issueTracker of getIssueTrackers()) {
|
||||||
if(issueTracker.isEligible()){
|
if(issueTracker.isEligible()){
|
||||||
|
console.log("Issue Tracker: " + issueTracker.name);
|
||||||
global.appFunctions = issueTracker;
|
global.appFunctions = issueTracker;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -51,8 +52,8 @@
|
|||||||
// add overlay frame
|
// add overlay frame
|
||||||
var appFrame = createOverlayFrame();
|
var appFrame = createOverlayFrame();
|
||||||
$("body").append(appFrame);
|
$("body").append(appFrame);
|
||||||
|
|
||||||
|
|
||||||
// add convinient fields
|
// add convinient fields
|
||||||
appFrame.window = appFrame.contentWindow;
|
appFrame.window = appFrame.contentWindow;
|
||||||
appFrame.document = appFrame.window.document;
|
appFrame.document = appFrame.window.document;
|
||||||
@ -125,10 +126,23 @@
|
|||||||
return Promise.all(promises);
|
return Promise.all(promises);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function error2object(value) {
|
||||||
|
if (value instanceof Error) {
|
||||||
|
var error = {};
|
||||||
|
Object.getOwnPropertyNames(value).forEach(function (key) {
|
||||||
|
error[key] = value[key];
|
||||||
|
});
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
function handleError(error){
|
function handleError(error){
|
||||||
console.log("ERROR " + JSON.stringify(error,2,2));
|
error = error2object(error);
|
||||||
ga('send', 'exception', { 'exDescription': error.message,'exFatal': true });
|
var error = JSON.stringify(error,2,2);
|
||||||
alert("Sorry something went wrong.\n\n" + error.message +"\n\nPlease create an issue at " + global.issueTrackingUrl + "\n\n" + error.stack);
|
console.log("ERROR " + error);
|
||||||
|
ga('send', 'exception', { 'exDescription': error, 'exFatal': true });
|
||||||
|
alert("Sorry something went wrong\n\nPlease create an issue with following details at\n" + global.issueTrackingUrl + "\n\n" + error);
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveSettings(){
|
function saveSettings(){
|
||||||
@ -216,7 +230,7 @@
|
|||||||
$("body", printFrameDocument).append(card);
|
$("body", printFrameDocument).append(card);
|
||||||
|
|
||||||
promises.push(global.appFunctions.getCardData(issueKey).then(function(cardData) {
|
promises.push(global.appFunctions.getCardData(issueKey).then(function(cardData) {
|
||||||
console.log("cardData: " + JSON.stringify(cardData,2,2));
|
// console.log("cardData: " + JSON.stringify(cardData,2,2));
|
||||||
ga('send', 'event', 'card', 'generate', cardData.type);
|
ga('send', 'event', 'card', 'generate', cardData.type);
|
||||||
fillCard(card, cardData);
|
fillCard(card, cardData);
|
||||||
redrawCards();
|
redrawCards();
|
||||||
@ -351,8 +365,8 @@
|
|||||||
var cardMaxHeight = Math.floor(bodyElement.outerHeight() / rowCount);
|
var cardMaxHeight = Math.floor(bodyElement.outerHeight() / rowCount);
|
||||||
|
|
||||||
var cardElement = $(".card", printFrame.document);
|
var cardElement = $(".card", printFrame.document);
|
||||||
var cardMinWidth = cardElement.css("min-width").replace("px", "");
|
var cardMinWidth = cardElement.css("min-width") ? cardElement.css("min-width").replace("px", "") : 0;
|
||||||
var cardMinHeight = cardElement.css("min-height").replace("px", "");
|
var cardMinHeight = cardElement.css("min-height") ? cardElement.css("min-height").replace("px", "") : 0;
|
||||||
|
|
||||||
var scaleWidth = cardMaxWidth / cardMinWidth ;
|
var scaleWidth = cardMaxWidth / cardMinWidth ;
|
||||||
var scaleHeight = cardMaxHeight / cardMinHeight ;
|
var scaleHeight = cardMaxHeight / cardMinHeight ;
|
||||||
@ -550,6 +564,7 @@
|
|||||||
var issueTrackers = []
|
var issueTrackers = []
|
||||||
|
|
||||||
var jiraFunctions = (function(module) {
|
var jiraFunctions = (function(module) {
|
||||||
|
module.name = "JIRA";
|
||||||
|
|
||||||
module.isEligible = function(){
|
module.isEligible = function(){
|
||||||
return $("meta[name='application-name'][ content='JIRA']").length > 0;
|
return $("meta[name='application-name'][ content='JIRA']").length > 0;
|
||||||
@ -558,28 +573,10 @@
|
|||||||
module.getSelectedIssueKeyList = function() {
|
module.getSelectedIssueKeyList = function() {
|
||||||
|
|
||||||
//Issues
|
//Issues
|
||||||
if (/.*\/issues\/\?jql=.*/g.test(document.URL)) {
|
if (/.*\/issues\/.*/g.test(document.URL)) {
|
||||||
var jql = document.URL.match(/.*\?jql=(.*)/)[1];
|
return $('tr[data-issuekey]').map(function() {
|
||||||
var jqlIssues = [];
|
return $(this).attr('data-issuekey');
|
||||||
var url = '/rest/api/2/search?jql=' + jql + "&maxResults=500&fields=key";
|
|
||||||
console.log("IssueUrl: " + url);
|
|
||||||
//console.log("Issue: " + issueKey + " Loading...");
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: url,
|
|
||||||
data: {},
|
|
||||||
dataType: 'json',
|
|
||||||
async: false,
|
|
||||||
success: function(responseData) {
|
|
||||||
console.log("responseData: " + responseData.issues);
|
|
||||||
|
|
||||||
$.each(responseData.issues, function(key, value) {
|
|
||||||
jqlIssues.push(value.key);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
console.log("jqlIssues: " + jqlIssues);
|
|
||||||
return jqlIssues;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Browse
|
//Browse
|
||||||
@ -663,8 +660,6 @@
|
|||||||
var url = '/rest/api/2/issue/' + issueKey + '?expand=renderedFields,names';
|
var url = '/rest/api/2/issue/' + issueKey + '?expand=renderedFields,names';
|
||||||
console.log("IssueUrl: " + url);
|
console.log("IssueUrl: " + url);
|
||||||
//console.log("Issue: " + issueKey + " Loading...");
|
//console.log("Issue: " + issueKey + " Loading...");
|
||||||
|
|
||||||
|
|
||||||
return httpGetJSON(url).then(function(responseData) {
|
return httpGetJSON(url).then(function(responseData) {
|
||||||
//console.log("Issue: " + issueKey + " Loaded!");
|
//console.log("Issue: " + issueKey + " Loaded!");
|
||||||
// add custom fields with field names
|
// add custom fields with field names
|
||||||
@ -684,6 +679,7 @@
|
|||||||
issueTrackers.push(jiraFunctions);
|
issueTrackers.push(jiraFunctions);
|
||||||
|
|
||||||
var youTrackFunctions = (function(module) {
|
var youTrackFunctions = (function(module) {
|
||||||
|
module.name = "YouTrack";
|
||||||
|
|
||||||
module.isEligible = function(){
|
module.isEligible = function(){
|
||||||
return /.*myjetbrains.com\/youtrack\/.*/g.test(document.URL) || /.*youtrack.jetbrains.com\/.*/g.test(document.URL);
|
return /.*myjetbrains.com\/youtrack\/.*/g.test(document.URL) || /.*youtrack.jetbrains.com\/.*/g.test(document.URL);
|
||||||
@ -692,7 +688,7 @@
|
|||||||
module.getSelectedIssueKeyList = function() {
|
module.getSelectedIssueKeyList = function() {
|
||||||
//Detail View
|
//Detail View
|
||||||
if (/.*\/issue\/.*/g.test(document.URL)) {
|
if (/.*\/issue\/.*/g.test(document.URL)) {
|
||||||
return [document.URL.replace(/.*\/issue\/([^?]*).*/)[1]];
|
return [document.URL.match(/.*\/issue\/([^?]*).*/)[1]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Agile Board
|
// Agile Board
|
||||||
@ -752,6 +748,7 @@
|
|||||||
issueTrackers.push(youTrackFunctions);
|
issueTrackers.push(youTrackFunctions);
|
||||||
|
|
||||||
var pivotalTrackerFunctions = (function(module) {
|
var pivotalTrackerFunctions = (function(module) {
|
||||||
|
module.name = "PivotalTracker";
|
||||||
|
|
||||||
module.isEligible = function(){
|
module.isEligible = function(){
|
||||||
return /.*pivotaltracker.com\/.*/g.test(document.URL);
|
return /.*pivotaltracker.com\/.*/g.test(document.URL);
|
||||||
@ -769,14 +766,14 @@
|
|||||||
return $(this).attr('data-id');
|
return $(this).attr('data-id');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Workspace Board
|
// Workspace Board
|
||||||
if (/.*\/workspaces\/.*/g.test(document.URL)) {
|
if (/.*\/workspaces\/.*/g.test(document.URL)) {
|
||||||
return $('.story[data-id]:has(.selector.selected)').map(function() {
|
return $('.story[data-id]:has(.selector.selected)').map(function() {
|
||||||
return $(this).attr('data-id');
|
return $(this).attr('data-id');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -821,6 +818,7 @@
|
|||||||
issueTrackers.push(pivotalTrackerFunctions);
|
issueTrackers.push(pivotalTrackerFunctions);
|
||||||
|
|
||||||
var trelloFunctions = (function(module) {
|
var trelloFunctions = (function(module) {
|
||||||
|
module.name = "trello";
|
||||||
|
|
||||||
module.isEligible = function(){
|
module.isEligible = function(){
|
||||||
return /.*trello.com\/.*/g.test(document.URL);
|
return /.*trello.com\/.*/g.test(document.URL);
|
||||||
@ -876,6 +874,7 @@
|
|||||||
issueTrackers.push(trelloFunctions);
|
issueTrackers.push(trelloFunctions);
|
||||||
|
|
||||||
var mingleFunctions = (function(module) {
|
var mingleFunctions = (function(module) {
|
||||||
|
module.name = "mingle";
|
||||||
|
|
||||||
module.isEligible = function(){
|
module.isEligible = function(){
|
||||||
return /.*mingle.thoughtworks.com\/.*/g.test(document.URL);
|
return /.*mingle.thoughtworks.com\/.*/g.test(document.URL);
|
||||||
@ -1734,4 +1733,6 @@
|
|||||||
|
|
||||||
return resources;
|
return resources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
4
card.css
4
card.css
@ -179,7 +179,7 @@ body {
|
|||||||
background-position: center;
|
background-position: center;
|
||||||
background-size: 63%;
|
background-size: 63%;
|
||||||
}
|
}
|
||||||
.issue-icon[type="loading"]{
|
.issue-icon[type="loading"] {
|
||||||
background-color: DEEPSKYBLUE;
|
background-color: DEEPSKYBLUE;
|
||||||
background-image: url(https://qoomon.github.io/Jira-Issue-Card-Printer/resources/icons/CloudLoading.png);
|
background-image: url(https://qoomon.github.io/Jira-Issue-Card-Printer/resources/icons/CloudLoading.png);
|
||||||
}
|
}
|
||||||
@ -187,7 +187,7 @@ body {
|
|||||||
background-color: GOLD;
|
background-color: GOLD;
|
||||||
background-image: url(https://qoomon.github.io/Jira-Issue-Card-Printer/resources/icons/Bulb.png);
|
background-image: url(https://qoomon.github.io/Jira-Issue-Card-Printer/resources/icons/Bulb.png);
|
||||||
}
|
}
|
||||||
.issue-icon[type="bug"].issue-icon[type="problem"], .issue-icon[type="correction"] {
|
.issue-icon[type="bug"].issue-icon[type="problem"], .issue-icon[type="correction"] {
|
||||||
background-color: CRIMSON;
|
background-color: CRIMSON;
|
||||||
background-image: url(https://qoomon.github.io/Jira-Issue-Card-Printer/resources/icons/Bug.png);
|
background-image: url(https://qoomon.github.io/Jira-Issue-Card-Printer/resources/icons/Bug.png);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user