Skip to content

Instantly share code, notes, and snippets.

@FranckyU
Last active August 29, 2015 13:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FranckyU/9682474 to your computer and use it in GitHub Desktop.
Save FranckyU/9682474 to your computer and use it in GitHub Desktop.
Helper for Node tree display - for a FB post comment
function display_sub_tree(node, _level)
{
level = _level || 0 ;
result = '<ul class="level-'+level+'">' ;
children_of(node).each(function(child)
{
result = result + '<li>' + child.name ;
if (children_of(child).length > 0)
{
result = result + display_sub_tree(child, level+1) ;
}
result = result + '</li>' ;
}) ;
result = result + '</ul>' ;
return result ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment