Apache-Voodoo
view release on metacpan or search on metacpan
lib/Apache/Voodoo/Debug/html/debug.js view on Meta::CPAN
// Ajax handler for Voodoo's native debugging functions. This contains modified versions
// of Sean Kane's Feather Ajax and the reference JSON parser found at JSON.org.
// The original copyright notices for those components appear below, along with
// comments in the code noting where they begin, end and how they were modified.
//Created by Sean Kane (http://celtickane.com/programming/code/ajax.php)
//Feather Ajax v1.0.1
/*
http://www.JSON.org/json2.js
2008-11-19
Public Domain.
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
See http://www.JSON.org/js.html
This is a reference implementation. You are free to copy, modify, or
redistribute.
This code should be minified before deployment.
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;
};
( run in 1.251 second using v1.01-cache-2.11-cpan-39bf76dae61 )