root / trunk / web / dojo / dojox / lang / docs.js @ 12
History | View | Annotate | Download (3.11 KB)
| 1 |
/*
|
|---|---|
| 2 |
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
| 3 |
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
| 4 |
see: http://dojotoolkit.org/license for details
|
| 5 |
*/
|
| 6 |
|
| 7 |
|
| 8 |
if(!dojo._hasResource["dojox.lang.docs"]){ |
| 9 |
dojo._hasResource["dojox.lang.docs"]=true; |
| 10 |
dojo.provide("dojox.lang.docs");
|
| 11 |
(function(){
|
| 12 |
function _1(_2){ |
| 13 |
}; |
| 14 |
var _3={};
|
| 15 |
var _4=[];
|
| 16 |
var _5=dojox.lang.docs._loadedDocs={};
|
| 17 |
var _6=function(_7,_8){ |
| 18 |
_3[_8]=_7; |
| 19 |
}; |
| 20 |
var _9=function(_a){ |
| 21 |
var _b=_a.type||""; |
| 22 |
var _c,_d=false,_e=false,_f; |
| 23 |
_b=_b.replace(/\?/,function(){ |
| 24 |
_d=true;
|
| 25 |
return ""; |
| 26 |
}); |
| 27 |
_b=_b.replace(/\[\]/,function(){ |
| 28 |
_e=true;
|
| 29 |
return ""; |
| 30 |
}); |
| 31 |
if(_b.match(/HTML/)){ |
| 32 |
_b="string";
|
| 33 |
}else{
|
| 34 |
if(_b=="String"||_b=="Number"||_b=="Boolean"||_b=="Object"||_b=="Array"||_b=="Integer"||_b=="Function"){ |
| 35 |
_b=_b.toLowerCase(); |
| 36 |
}else{
|
| 37 |
if(_b=="bool"){ |
| 38 |
_b="boolean";
|
| 39 |
}else{
|
| 40 |
if(_b){
|
| 41 |
_c=dojo.getObject(_b)||{};
|
| 42 |
_f=true;
|
| 43 |
}else{
|
| 44 |
_c={};
|
| 45 |
} |
| 46 |
} |
| 47 |
} |
| 48 |
} |
| 49 |
_c=_c||{type:_b};
|
| 50 |
if(_e){
|
| 51 |
_c={items:_c,type:"array"};
|
| 52 |
_f=false;
|
| 53 |
} |
| 54 |
if(!_f){
|
| 55 |
if(_d){
|
| 56 |
_c.optional=true;
|
| 57 |
} |
| 58 |
if(/const/.test(_a.tags)){ |
| 59 |
_c.readonly=true;
|
| 60 |
} |
| 61 |
} |
| 62 |
return _c;
|
| 63 |
}; |
| 64 |
var _10=function(_11,_12){ |
| 65 |
var _13=_5[_12];
|
| 66 |
if(_13){
|
| 67 |
_11.description=_13.description; |
| 68 |
_11.properties={};
|
| 69 |
_11.methods={};
|
| 70 |
if(_13.properties){
|
| 71 |
var _14=_13.properties;
|
| 72 |
for(var i=0,l=_14.length;i<l;i++){ |
| 73 |
if(_14[i].scope=="prototype"){ |
| 74 |
var _15=_11.properties[_14[i].name]=_9(_14[i]);
|
| 75 |
_15.description=_14[i].summary; |
| 76 |
} |
| 77 |
} |
| 78 |
} |
| 79 |
if(_13.methods){
|
| 80 |
var _16=_13.methods;
|
| 81 |
for(i=0,l=_16.length;i<l;i++){ |
| 82 |
_12=_16[i].name; |
| 83 |
if(_12&&_16[i].scope=="prototype"){ |
| 84 |
var _17=_11.methods[_12]={};
|
| 85 |
_17.description=_16[i].summary; |
| 86 |
var _18=_16[i].parameters;
|
| 87 |
if(_18){
|
| 88 |
_17.parameters=[]; |
| 89 |
for(var j=0,k=_18.length;j<k;j++){ |
| 90 |
var _19=_18[j];
|
| 91 |
var _1a=_17.parameters[j]=_9(_19);
|
| 92 |
_1a.name=_19.name; |
| 93 |
_1a.optional="optional"==_19.usage;
|
| 94 |
} |
| 95 |
} |
| 96 |
var ret=_16[i]["return-types"]; |
| 97 |
if(ret&&ret[0]){ |
| 98 |
var _1b=_9(ret[0]); |
| 99 |
if(_1b.type){
|
| 100 |
_17.returns=_1b; |
| 101 |
} |
| 102 |
} |
| 103 |
} |
| 104 |
} |
| 105 |
} |
| 106 |
var _1c=_13.superclass;
|
| 107 |
if(_1c){
|
| 108 |
_11["extends"]=dojo.getObject(_1c);
|
| 109 |
} |
| 110 |
} |
| 111 |
}; |
| 112 |
var _1d=function(_1e){ |
| 113 |
_4.push(_1e); |
| 114 |
}; |
| 115 |
var _1f=dojo.declare;
|
| 116 |
dojo.declare=function(_20){ |
| 117 |
var _21=_1f.apply(this,arguments); |
| 118 |
_6(_21,_20); |
| 119 |
return _21;
|
| 120 |
}; |
| 121 |
dojo.mixin(dojo.declare,_1f); |
| 122 |
var _22;
|
| 123 |
var _23=dojo.require;
|
| 124 |
dojo.require=function(_24){ |
| 125 |
_1d(_24); |
| 126 |
var _25=_23.apply(this,arguments); |
| 127 |
return _25;
|
| 128 |
}; |
| 129 |
dojox.lang.docs.init=function(_26){ |
| 130 |
function _27(){ |
| 131 |
dojo.require=_23; |
| 132 |
_4=null;
|
| 133 |
try{
|
| 134 |
dojo.xhrGet({sync:!_26,url:dojo.baseUrl+"../util/docscripts/api.json",handleAs:"text"}).addCallbacks(function(obj){
|
| 135 |
_5=(new Function("return "+obj))(); |
| 136 |
obj=null;
|
| 137 |
_6=_10; |
| 138 |
for(var i in _3){ |
| 139 |
_6(_3[i],i); |
| 140 |
} |
| 141 |
_3=null;
|
| 142 |
},_1); |
| 143 |
} |
| 144 |
catch(e){
|
| 145 |
_1(e); |
| 146 |
} |
| 147 |
}; |
| 148 |
if(_22){
|
| 149 |
return null; |
| 150 |
} |
| 151 |
_22=true;
|
| 152 |
var _28=function(_29,_2a){ |
| 153 |
return dojo.xhrGet({sync:_2a||!_26,url:dojo.baseUrl+"../util/docscripts/api/"+_29+".json",handleAs:"text"}).addCallback(function(obj){ |
| 154 |
obj=(new Function("return "+obj))(); |
| 155 |
for(var _2b in obj){ |
| 156 |
if(!_5[_2b]){
|
| 157 |
_5[_2b]=obj[_2b]; |
| 158 |
} |
| 159 |
} |
| 160 |
}); |
| 161 |
}; |
| 162 |
try{
|
| 163 |
var _2c=_4.shift();
|
| 164 |
_28(_2c,true).addCallbacks(function(){ |
| 165 |
_1d=function(_2d){ |
| 166 |
if(!_5[_2d]){
|
| 167 |
try{
|
| 168 |
_28(_2d); |
| 169 |
} |
| 170 |
catch(e){
|
| 171 |
_5[_2d]={};
|
| 172 |
} |
| 173 |
} |
| 174 |
}; |
| 175 |
dojo.forEach(_4,function(mod){
|
| 176 |
_1d(mod); |
| 177 |
}); |
| 178 |
_4=null;
|
| 179 |
_6=_10; |
| 180 |
for(i in _3){ |
| 181 |
_6(_3[i],i); |
| 182 |
} |
| 183 |
_3=null;
|
| 184 |
},_27); |
| 185 |
} |
| 186 |
catch(e){
|
| 187 |
_27(); |
| 188 |
} |
| 189 |
return null; |
| 190 |
}; |
| 191 |
})(); |
| 192 |
} |