Enable JS error reporting.

This commit is contained in:
Paulo Gustavo Veiga 2015-04-09 23:37:39 -03:00
parent 89772a9e6e
commit 33b9a679d3

View File

@ -20,18 +20,18 @@ var designer = null;
/* /*
* Disclaimer: this global variable is a temporary workaround to Mootools' Browser class * Disclaimer: this global variable is a temporary workaround to Mootools' Browser class
* We need to avoid browser detection and replace it with feature detection, * We need to avoid browser detection and replace it with feature detection,
* jquery recommends: http://www.modernizr.com/ * jquery recommends: http://www.modernizr.com/
*/ */
Browser = { Browser = {
firefox: window.globalStorage, firefox: window.globalStorage,
ie: document.all && !window.opera, ie: document.all && !window.opera,
ie6: !window.XMLHttpRequest, ie6: !window.XMLHttpRequest,
ie7: document.all && window.XMLHttpRequest && !XDomainRequest && !window.opera, ie7: document.all && window.XMLHttpRequest && !XDomainRequest && !window.opera,
ie8: document.documentMode==8, ie8: document.documentMode == 8,
ie11: document.documentMode==11, ie11: document.documentMode == 11,
opera: Boolean(window.opera), opera: Boolean(window.opera),
chrome: Boolean(window.chrome), chrome: Boolean(window.chrome),
safari: window.getComputedStyle && !window.globalStorage && !window.opera, safari: window.getComputedStyle && !window.globalStorage && !window.opera,
@ -42,7 +42,7 @@ Browser = {
function buildDesigner(options) { function buildDesigner(options) {
var container = $("#"+options.container); var container = $("#" + options.container);
$assert(container, 'container could not be null'); $assert(container, 'container could not be null');
// Register load events ... // Register load events ...
@ -73,9 +73,9 @@ function buildDesigner(options) {
errorMsg = errorMsg.toString(); errorMsg = errorMsg.toString();
$.ajax({ $.ajax({
method:'post', method: 'post',
url:"/c/restful/logger/editor", url: "/c/restful/logger/editor",
headers:{"Content-Type":"application/json", "Accept":"application/json"}, headers: {"Content-Type": "application/json", "Accept": "application/json"},
data: { data: {
jsErrorMsg: "Message: '" + errorMsg + "', line:'" + lineNo + "', url: :" + url, jsErrorMsg: "Message: '" + errorMsg + "', line:'" + lineNo + "', url: :" + url,
jsStack: window.errorStack, jsStack: window.errorStack,
@ -97,8 +97,7 @@ function buildDesigner(options) {
} }
}; };
// @Todo: Remove this after all is fixed. window.onerror = onerrorFn;
// window.onerror = onerrorFn;
// Configure default persistence manager ... // Configure default persistence manager ...
var persistence; var persistence;
@ -121,7 +120,7 @@ function buildDesigner(options) {
// If a node has focus, focus can be move to another node using the keys. // If a node has focus, focus can be move to another node using the keys.
designer._cleanScreen = function () { designer._cleanScreen = function () {
menu.clear() menu.clear();
}; };
} }
@ -148,41 +147,49 @@ function loadDesignerOptions(jsonConf) {
else { else {
// Set workspace screen size as default. In this way, resize issues are solved. // Set workspace screen size as default. In this way, resize issues are solved.
var containerSize = { var containerSize = {
height:parseInt(screen.height), height: parseInt(screen.height),
width:parseInt(screen.width) width: parseInt(screen.width)
}; };
var viewPort = { var viewPort = {
height:parseInt(window.innerHeight - 70), // Footer and Header height: parseInt(window.innerHeight - 70), // Footer and Header
width:parseInt(window.innerWidth) width: parseInt(window.innerWidth)
};
result = {
readOnly: false,
zoom: 0.85,
saveOnLoad: true,
size: containerSize,
viewPort: viewPort,
container: 'mindplot',
locale: 'en'
}; };
result = {readOnly:false, zoom:0.85, saveOnLoad:true, size:containerSize, viewPort:viewPort, container:'mindplot', locale:'en'};
} }
return result; return result;
} }
editor = {}; editor = {};
editor.WaitDialog = new Class({ editor.WaitDialog = new Class({
initialize:function () { initialize: function () {
this.panel = this._buildPanel(); this.panel = this._buildPanel();
}, },
_buildPanel:function () { _buildPanel: function () {
var result = $('#load'); var result = $('#load');
var content = result.find('.modal-content'); var content = result.find('.modal-content');
var winH = $(window).height(); var winH = $(window).height();
//Set the popup window to center //Set the popup window to center
content.css('margin-top', winH/2 - content.height()/2); content.css('margin-top', winH / 2 - content.height() / 2);
return result; return result;
}, },
show:function () { show: function () {
this.panel.modal({ this.panel.modal({
backdrop: 'static' backdrop: 'static'
}); });
}, },
close: function() { close: function () {
this.panel.modal('hide'); this.panel.modal('hide');
} }
}); });