Created
October 17, 2014 04:21
-
-
Save zzggbb/738e72c94d099567a05b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function create_file(file) { | |
| return $('<li>').append($('<span>').attr('id','file').text(file)); | |
| } | |
| function create_dir(dir) { | |
| return $('<li>') | |
| .append($('<span>').attr('id','dir').text(dir.name).click(function(){$(this).next().slideToggle()})) | |
| .append($('<ul>') | |
| .append( | |
| dir.files.length > 0 ? dir.files.map(create_file) : null | |
| ).append( | |
| dir.dirs.length > 0 ? dir.dirs.map(create_dir) : null | |
| ) | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment