49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
|
function debug(msg) {
|
||
|
// no-op
|
||
|
}
|
||
|
|
||
|
function setCookie(name, value, lifetime, path, domain, secure) {
|
||
|
|
||
|
var d = false;
|
||
|
|
||
|
if (lifetime) {
|
||
|
d = new Date();
|
||
|
d.setTime(d.getTime() + (lifetime * 1000));
|
||
|
}
|
||
|
|
||
|
debug("setCookie: " + name + " => " + value + ": " + d);
|
||
|
|
||
|
int_setCookie(name, value, d, path, domain, secure);
|
||
|
|
||
|
}
|
||
|
|
||
|
function int_setCookie(name, value, expires, path, domain, secure) {
|
||
|
document.cookie= name + "=" + escape(value) +
|
||
|
((expires) ? "; expires=" + expires.toGMTString() : "") +
|
||
|
((path) ? "; path=" + path : "") +
|
||
|
((domain) ? "; domain=" + domain : "") +
|
||
|
((secure) ? "; secure" : "");
|
||
|
}
|
||
|
|
||
|
function exception_error(location, e, silent) {
|
||
|
var msg;
|
||
|
|
||
|
if (e.fileName) {
|
||
|
var base_fname = e.fileName.substring(e.fileName.lastIndexOf("/") + 1);
|
||
|
|
||
|
msg = "Exception: " + e.name + ", " + e.message +
|
||
|
"\nFunction: " + location + "()" +
|
||
|
"\nLocation: " + base_fname + ":" + e.lineNumber;
|
||
|
|
||
|
} else if (e.description) {
|
||
|
msg = "Exception: " + e.description + "\nFunction: " + location + "()";
|
||
|
} else {
|
||
|
msg = "Exception: " + e + "\nFunction: " + location + "()";
|
||
|
}
|
||
|
|
||
|
if (!silent) {
|
||
|
alert(msg);
|
||
|
}
|
||
|
}
|
||
|
|