improve error handling
This commit is contained in:
parent
0a4da76e1b
commit
7191334631
@ -1,36 +1,34 @@
|
|||||||
(function() {
|
(function() {
|
||||||
var version = "3.5.0";
|
var version = "3.5.0";
|
||||||
console.log("Version: " + version);
|
console.log("Version: " + version);
|
||||||
|
|
||||||
var global = {};
|
var global = {};
|
||||||
|
global.isDev = /.*jira.atlassian.com\/secure\/RapidBoard.jspa\?.*projectKey=ANERDS.*/g.test(document.URL) // Jira
|
||||||
|
|| /.*pivotaltracker.com\/n\/projects\/510733.*/g.test(document.URL) // PivotTracker
|
||||||
|
|| ( /.*trello.com\/.*/g.test(document.URL) && jQuery("span.js-member-name").text() =='Bengt Brodersen'); // Trello
|
||||||
|
global.isProd = !global.isDev;
|
||||||
|
|
||||||
try {
|
window.addEventListener("error", function(event) {
|
||||||
// load jQuery
|
var error = event.error;
|
||||||
if (window.jQuery === undefined) {
|
console.log("ERROR: " + error.stack);
|
||||||
appendScript('//ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js');
|
|
||||||
}
|
|
||||||
|
|
||||||
// wait untill all scripts loaded
|
|
||||||
appendScript('https://qoomon.github.io/void', function() {
|
|
||||||
try {
|
|
||||||
main();
|
|
||||||
} catch (err) {
|
|
||||||
handleError(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (err) {
|
|
||||||
handleError(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleError(err){
|
|
||||||
console.log("ERROR: " + err.stack);
|
|
||||||
if (global.isProd) {
|
if (global.isProd) {
|
||||||
ga('send', 'exception', {
|
ga('send', 'exception', {
|
||||||
'exDescription': err.message,
|
'exDescription': error.message,
|
||||||
'exFatal': true
|
'exFatal': true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// load jQuery
|
||||||
|
if (window.jQuery === undefined) {
|
||||||
|
appendScript('//ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// wait untill all scripts loaded
|
||||||
|
appendScript('https://qoomon.github.io/void', function() {
|
||||||
|
main();
|
||||||
|
});
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
init();
|
init();
|
||||||
|
|
||||||
@ -66,6 +64,11 @@
|
|||||||
jQuery("body").append(printOverlayHTML());
|
jQuery("body").append(printOverlayHTML());
|
||||||
jQuery("#card-print-overlay").prepend(printOverlayStyle());
|
jQuery("#card-print-overlay").prepend(printOverlayStyle());
|
||||||
|
|
||||||
|
var printFrame = jQuery("#card-print-dialog-content-iframe");
|
||||||
|
var printWindow = printFrame[0].contentWindow;
|
||||||
|
printWindow.addEventListener("resize", function(){redrawCards;});
|
||||||
|
printWindow.matchMedia("print").addListener(function(){redrawCards;});
|
||||||
|
|
||||||
jQuery("#rowCount").val(readCookie("card_printer_row_count",2));
|
jQuery("#rowCount").val(readCookie("card_printer_row_count",2));
|
||||||
jQuery("#columnCount").val(readCookie("card_printer_column_count",1));
|
jQuery("#columnCount").val(readCookie("card_printer_column_count",1));
|
||||||
jQuery("#font-scale-range").val(readCookie("card_printer_font_scale",1));
|
jQuery("#font-scale-range").val(readCookie("card_printer_font_scale",1));
|
||||||
@ -87,11 +90,6 @@
|
|||||||
addStringFunctions();
|
addStringFunctions();
|
||||||
addDateFunctions();
|
addDateFunctions();
|
||||||
|
|
||||||
global.isDev = /.*jira.atlassian.com\/secure\/RapidBoard.jspa\?.*projectKey=ANERDS.*/g.test(document.URL) // Jira
|
|
||||||
|| /.*pivotaltracker.com\/n\/projects\/510733.*/g.test(document.URL) // PivotTracker
|
|
||||||
|| ( /.*trello.com\/.*/g.test(document.URL) && jQuery("span.js-member-name").text() =='Bengt Brodersen'); // Trello
|
|
||||||
global.isProd = !global.isDev;
|
|
||||||
|
|
||||||
global.hostOrigin = "https://qoomon.github.io/Jira-Issue-Card-Printer/";
|
global.hostOrigin = "https://qoomon.github.io/Jira-Issue-Card-Printer/";
|
||||||
if (global.isDev) {
|
if (global.isDev) {
|
||||||
console.log("DEVELOPMENT");
|
console.log("DEVELOPMENT");
|
||||||
@ -105,24 +103,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function print() {
|
function print() {
|
||||||
try {
|
if (global.isProd) {
|
||||||
var printFrame = jQuery("#card-print-dialog-content-iframe");
|
ga('send', 'event', 'button', 'click', 'print', jQuery(".card", printDocument).length);
|
||||||
var printWindow = printFrame[0].contentWindow;
|
|
||||||
var printDocument = printWindow.document;
|
|
||||||
if (global.isProd) {
|
|
||||||
ga('send', 'event', 'button', 'click', 'print', jQuery(".card", printDocument).length);
|
|
||||||
}
|
|
||||||
///////////////////////////////////////// SCRIPT SHOULD ADDED TO PRINT PAGE
|
|
||||||
|
|
||||||
printWindow.addEventListener("resize", function(){redrawCards;});
|
|
||||||
printWindow.matchMedia("print").addListener(function(){redrawCards;});
|
|
||||||
|
|
||||||
/////////////////////////////////////////
|
|
||||||
|
|
||||||
printWindow.print();
|
|
||||||
} catch (err) {
|
|
||||||
handleError(err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var printFrame = jQuery("#card-print-dialog-content-iframe");
|
||||||
|
var printWindow = printFrame[0].contentWindow;
|
||||||
|
printWindow.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderCards(issueKeyList, callback) {
|
function renderCards(issueKeyList, callback) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user