Apache-Voodoo
view release on metacpan or search on metacpan
lib/Apache/Voodoo/Debug/html/debug.js view on Meta::CPAN
See http://javascript.crockford.com/jsmin.html
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
NOT CONTROL.
*/
function voodooJson() {
//////////////////////////////////////////////////////////////////////////////////
// JSON library
//
// The stringify function and it's supporting functions have been removed
// since this object only needs the parse function.
// The comments were extremely verbose and have been removed.
//////////////////////////////////////////////////////////////////////////////////
this.f = function (n) {
return n<10?'0'+n:n;
};
if (typeof Date.prototype.toJSON !== 'function') {
Date.prototype.toJSON = function(key) {
return this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z';
};
String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function (key) {
return this.valueOf();
};
}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapeable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g...
this.parse = function(text,reviver) {
var j;
function walk(holder,key) {
var k,v,value = holder[key];
if (value&&typeof value==='object') {
for (k in value) {
if (Object.hasOwnProperty.call(value,k)) {
v = walk(value,k);
if (v!==undefined) {
value[k]=v;
}
else {
delete value[k];
}
}
}
}
return reviver.call(holder,key,value);
}
cx.lastIndex=0;
if (cx.test(text)) {
text=text.replace(cx,
function(a) {
return '\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);
}
);
}
if (/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))) {
j = eval('('+text+')');
return typeof reviver==='function'?walk({'':j},''):j;
}
throw new SyntaxError('voodooDebug.parse');
};
}
function voodooAjax() {
//////////////////////////////////////////////////////////////////////////////////
// Feather Ajax
//////////////////////////////////////////////////////////////////////////////////
// reference to the calling object
this.caller = null;
// ..and the associated set method
this.setResponseHandler = function(obj) {
this.caller = obj;
};
this.createRequestObject = function() {
var ro;
try {
ro=new XMLHttpRequest();
}
catch(e) {
ro=new ActiveXObject("Microsoft.XMLHTTP");
}
return ro;
};
this.http = this.createRequestObject();
var me = this;
this.sndReq = function(action,url,data) {
if (action.toUpperCase()=="POST") {
this.http.open(action,url,true);
this.http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
this.http.onreadystatechange=this.handleResponse;
this.http.send(data);
}
else {
this.http.open(action,url+'?'+data,true);
this.http.onreadystatechange=this.handleResponse;
this.http.send(null);
}
};
this.handleResponse = function() {
// Stripped down to only call the response handler passing it the response content
if (me.http.readyState==4) {
me.caller.handleResponse(me.http.responseText);
}
};
}
function voodooDebug(opts) {
this.debug_root = opts.debug_root;
this.app_id = opts.app_id;
this.session_id = opts.session_id;
this.request_id = opts.request_id;
this.origin_id = this.request_id;
this.imgSpinner = new Image(16,16);
( run in 1.705 second using v1.01-cache-2.11-cpan-39bf76dae61 )