123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- if(!dojo._hasResource["dojo._base.json"]){
- dojo._hasResource["dojo._base.json"] = true;
- dojo.provide("dojo._base.json");
- dojo.fromJson = function(/*String*/ json){
-
-
-
-
-
-
-
-
-
- return eval("(" + json + ")");
- };
- dojo._escapeString = function(/*String*/str){
-
-
-
-
- return ('"' + str.replace(/(["\\])/g, '\\$1') + '"').
- replace(/[\f]/g, "\\f").replace(/[\b]/g, "\\b").replace(/[\n]/g, "\\n").
- replace(/[\t]/g, "\\t").replace(/[\r]/g, "\\r");
- };
- dojo.toJsonIndentStr = "\t";
- dojo.toJson = function(/*Object*/ it, /*Boolean?*/ prettyPrint, /*String?*/ _indentStr){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(it === undefined){
- return "undefined";
- }
- var objtype = typeof it;
- if(objtype == "number" || objtype == "boolean"){
- return it + "";
- }
- if(it === null){
- return "null";
- }
- if(dojo.isString(it)){
- return dojo._escapeString(it);
- }
-
- var recurse = arguments.callee;
-
-
- var newObj;
- _indentStr = _indentStr || "";
- var nextIndent = prettyPrint ? _indentStr + dojo.toJsonIndentStr : "";
- var tf = it.__json__||it.json;
- if(dojo.isFunction(tf)){
- newObj = tf.call(it);
- if(it !== newObj){
- return recurse(newObj, prettyPrint, nextIndent);
- }
- }
- if(it.nodeType && it.cloneNode){
-
-
-
- throw new Error("Can't serialize DOM nodes");
- }
- var sep = prettyPrint ? " " : "";
- var newLine = prettyPrint ? "\n" : "";
-
- if(dojo.isArray(it)){
- var res = dojo.map(it, function(obj){
- var val = recurse(obj, prettyPrint, nextIndent);
- if(typeof val != "string"){
- val = "undefined";
- }
- return newLine + nextIndent + val;
- });
- return "[" + res.join("," + sep) + newLine + _indentStr + "]";
- }
-
- if(objtype == "function"){
- return null;
- }
-
- var output = [], key;
- for(key in it){
- var keyStr, val;
- if(typeof key == "number"){
- keyStr = '"' + key + '"';
- }else if(typeof key == "string"){
- keyStr = dojo._escapeString(key);
- }else{
-
- continue;
- }
- val = recurse(it[key], prettyPrint, nextIndent);
- if(typeof val != "string"){
-
- continue;
- }
-
-
- output.push(newLine + nextIndent + keyStr + ":" + sep + val);
- }
- return "{" + output.join("," + sep) + newLine + _indentStr + "}";
- };
- }
|