You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.7 KiB
61 lines
1.7 KiB
var tts_project = ""; // Please set this var from tts_set_project(...)
|
|
function tts_set_project(prj) {
|
|
tts_project = prj;
|
|
}
|
|
|
|
function tts_log(msg){
|
|
if (window.console && console.info) {
|
|
console.info(msg);
|
|
} else {
|
|
if (window.console && console.log) {
|
|
console.log(msg); /* for Chorme Console is enabled */
|
|
}
|
|
}
|
|
}
|
|
|
|
/* Set Cookie */
|
|
function tts_set_cookie(cname, cvalue, exdays) {
|
|
var d = new Date();
|
|
d.setTime(d.getTime() + (exdays*24*60*60*1000));
|
|
var expires = "expires="+d.toUTCString();
|
|
document.cookie = cname + "=" + cvalue + "; " + expires;
|
|
}
|
|
|
|
/* Get Cookie */
|
|
function tts_get_cookie(cname) {
|
|
var name = cname + "=";
|
|
var ca = document.cookie.split(';');
|
|
for(var i=0; i<ca.length; i++) {
|
|
var c = ca[i];
|
|
while (c.charAt(0)==' ') c = c.substring(1);
|
|
if (c.indexOf(name) != -1) return c.substring(name.length,c.length);
|
|
}
|
|
return "";
|
|
}
|
|
|
|
function tts_get_JSONP(response) {
|
|
var fixedResponse = response.responseText.replace(/\\'/g, "'");
|
|
return JSON.parse(fixedResponse);
|
|
}
|
|
|
|
var sent_errors_yet = false;
|
|
|
|
function tts_do_error(msg,url,ln) {
|
|
var strValues = "errMsg=" + escape(msg);
|
|
strValues += "&errLine=" + ln;
|
|
strValues += "&queryString=" + escape(location.search);
|
|
strValues += "&Url=" + escape(location.pathname);
|
|
strValues += "&HTTPRef=" + escape(document.referrer);
|
|
|
|
if (sent_errors_yet === false) {
|
|
var objSave = new XMLHttpRequest();
|
|
objSave.open("POST", tts_project+"/app/home/error_save.html", true);
|
|
objSave.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
objSave.send(strValues);
|
|
}
|
|
sent_errors_yet = true;
|
|
}
|
|
|
|
try {
|
|
window.onerror = tts_do_error;
|
|
} catch(er) {} |