This repository has been archived by the owner on Feb 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsendReport.js
87 lines (72 loc) · 2.82 KB
/
sendReport.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
var page = {
logAsString: "",
bgr: null,
filepath: '',
init: function() {
this.bgr = chrome.extension.getBackgroundPage();
this.appendToLog("app: " + navigator.appVersion + "\n");
this.appendToLog("username: " + this.bgr.username + "\n");
this.appendPreferencesToLog();
// this.appendAddonInfoToLog();
this.appendReportToLog();
},
appendPreferencesToLog: function() {
this.appendToLog("\npreferences:\n");
this.appendToLog("SystemArea -> " + this.bgr.backgroundProcess.systemArea + "\n");
this.appendToLog("AddOn-Version -> " + this.bgr.backgroundProcess.version + "\n");
for(var _prefName in localStorage) {
if(_prefName == "password") continue;
this.appendToLog(_prefName+" -> "+ localStorage[_prefName] +"\n");
}
},
appendAddonInfoToLog: function() {
if(this.bgr.addOnInfo !== null) {
this.appendToLog("\naddOnInfo:\n");
for(var key in this.bgr.addOnInfo) {
try {
if(typeof this.bgr.addOnInfo[key] != 'object' && typeof this.bgr.addOnInfo[key] != 'function') {
this.appendToLog(" '"+key+"' -> " + this.bgr.addOnInfo[key] + "\n");
}
} catch (e) {}
}
}
},
appendReportToLog: function() {
var logArray = this.bgr.logBuffer.buffer;
this.appendToLog("\nreport:\n");
for (var i=0; i < logArray.length; i++) {
this.appendToLog(logArray[i]+"\n");
}
},
appendToLog: function(txt) {
this.logAsString += txt;
},
displayLog: function() {
this.logAsString = this.logAsString.replace(/</g, '<');
this.logAsString = this.logAsString.replace(/>/g, '>');
document.getElementById('fileContent').innerHTML = this.logAsString;
},
showLocalizedFileInfo: function() {
if (navigator.language.match(/^de/)) {
document.getElementById('redBox').innerHTML = 'Bitte senden Sie diesen Bericht <b>nicht</b>, wenn Sie sipgateGCX erwartungsgemäß funktioniert. Dieser Report dient ausschließlich der Fehlerbehebung!';
var msg = "";
msg += "Bitte schicken Sie den Inhalt des grauen Kastens per E-Mail an: <a href=\"mailto:[email protected]?subject=" + escape("Statusbericht sipgateGCX") + "\">[email protected]</a><BR>\n";
document.getElementById('userMessage').innerHTML = msg;
} else {
document.getElementById('redBox').innerHTML = 'Please do <b>not</b> send this report, if you don\'t encounter any problems with sipgateGCX. This report is for troubleshooting purposes only!';
var msg = "";
msg += "Please send the content of the gray box via email to <a href=\"mailto:[email protected]?subject=" + escape("Status report sipgateGCX") + "\">[email protected]</a><BR>\n";
document.getElementById('userMessage').innerHTML = msg;
}
},
foo: function() {}
};
document.addEventListener('DOMContentLoaded', function () {
try {
page.init();
page.showLocalizedFileInfo();
page.displayLog();
} catch (e) {
alert(e);
}
});