mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	added file count to fs browser...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									6831bfcddb
								
							
						
					
					
						commit
						11cef78715
					
				| @ -187,6 +187,16 @@ | ||||
| 
 | ||||
| 	overflow: hidden; | ||||
| } | ||||
| .browse-widget .list>div:after { | ||||
| 	display: inline-block; | ||||
| 
 | ||||
| 	content: attr(count); | ||||
| 
 | ||||
| 	float: right; | ||||
| 	margin-right: 10px; | ||||
| 
 | ||||
| 	opacity: 0.4; | ||||
| } | ||||
| .browse-widget .list>div.strike-out .text { | ||||
| 	text-decoration: line-through; | ||||
| 	opacity: 0.3; | ||||
|  | ||||
| @ -100,6 +100,7 @@ function(path, make){ | ||||
| 	// list dirs...
 | ||||
| 	} else { | ||||
| 		return new promise(function(resolve, reject){ | ||||
| 			// XXX should this be a promise???
 | ||||
| 			fs.readdir(path, function(err, files){ | ||||
| 				// XXX
 | ||||
| 				if(err){ | ||||
| @ -116,9 +117,21 @@ function(path, make){ | ||||
| 								: file, null, true) | ||||
| 						}) | ||||
| 						.then(function(res){ | ||||
| 							res && make(fullpath  | ||||
| 							var dir = res.isDirectory() | ||||
| 							var elem = res && make(fullpath  | ||||
| 								? path +'/'+ file  | ||||
| 								: file + (res.isDirectory() ? '/' : '')) | ||||
| 								: file + (dir ? '/' : '')) | ||||
| 
 | ||||
| 							// count the number of files...
 | ||||
| 							// NOTE: we do not care how long it will take
 | ||||
| 							// 		so we'll not wait...
 | ||||
| 							if(res && dir){ | ||||
| 								fs.readdir(path +'/'+ file, function(err, files){ | ||||
| 									if(!err){ | ||||
| 										elem.attr('count', '('+ files.length +')') | ||||
| 									} | ||||
| 								}) | ||||
| 							} | ||||
| 						}) | ||||
| 						// NOTE: we are not using promise.all(..) here because it
 | ||||
| 						// 		triggers BEFORE the first make(..) is called...
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user