Lots of documentation overhaul - much more documented, cat output works better now.

This commit is contained in:
John Resig 2006-09-01 05:52:26 +00:00
parent 805d21c236
commit c8009abcce
7 changed files with 1181 additions and 1180 deletions

View file

@ -69,7 +69,7 @@ function parse( f ) {
}
function categorize( json ) {
var obj = { methods: [] };
var obj = { cat: [], method: [] };
for ( var i = 0; i < json.length; i++ ) {
if ( !json[i].cat ) json[i].cat = "";
@ -79,17 +79,26 @@ function categorize( json ) {
var pos = obj;
for ( var j = 0; j < cat.length; j++ ) {
var c = cat[j];
var curCat = null;
// Locate current category
for ( var n = 0; n < pos.cat.length; n++ )
if ( pos.cat[n].value == c )
curCat = pos.cat[n];
// Create current category
if ( !pos[c] ) pos[c] = { methods: [] };
if ( !curCat ) {
curCat = { value: c, cat: [], method: [] };
pos.cat.push( curCat )
}
// If we're at the end, add the method
if ( j == cat.length - 1 )
pos[c].methods.push( json[i] );
curCat.method.push( json[i] );
// Otherwise, traverse deeper
else
pos = pos[c];
pos = curCat;
}
}