mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	tweaking tag sorting in cloud...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									cbf420cbc4
								
							
						
					
					
						commit
						74517e5c03
					
				| @ -270,33 +270,33 @@ var TagUIActions = actions.Actions({ | |||||||
| 							t,  | 							t,  | ||||||
| 							i,  | 							i,  | ||||||
| 							(that.data.tags.values(t) || []).length, | 							(that.data.tags.values(t) || []).length, | ||||||
| 							tags.indexOf(t) >= 0] }) | 							tags.indexOf(t) >= 0 ] }) | ||||||
| 					// XXX add ability to sort by popularity, both local
 | 					// XXX add ability to sort by popularity, both local
 | ||||||
| 					//		(selected tags) and global...
 | 					//		(selected tags) and global...
 | ||||||
| 					.run(function(){ | 					.run(function(){ | ||||||
| 						return opts.sortTagsBy == 'name' ? | 						return opts.sortTagsBy == 'name' ? | ||||||
| 								this | 								this | ||||||
| 							// count...
 | 							// usage and count...
 | ||||||
| 							: this.sort(function(a, b){ | 							: this.sort(function(a, b){ | ||||||
| 								var ac = a[2] | 								var ac = a[2] | ||||||
| 								var bc = b[2] | 								var bc = b[2] | ||||||
| 
 | 
 | ||||||
| 								return ac != null && bc != null ?  | 								return ( | ||||||
| 										bc - ac |  | ||||||
| 									// keep set tags before unset...
 | 									// keep set tags before unset...
 | ||||||
| 									// XXX these do not seem to work...
 | 									a[3] && !b[3] ? | ||||||
| 									: a[3] && !b[3] ? | 										-1 | ||||||
| 										1 |  | ||||||
| 									: !a[3] && b[3] ? | 									: !a[3] && b[3] ? | ||||||
| 										-1 |  | ||||||
| 									// keep used tags before unused...
 |  | ||||||
| 									: ac == null || (!a[3] && b[3]) ? |  | ||||||
| 										1 | 										1 | ||||||
| 									: bc == null || (a[3] && !b[3]) ? | 									// sort by usage count...
 | ||||||
|  | 									: ac != null && bc != null ?  | ||||||
|  | 										bc - ac | ||||||
|  | 									// keep used tags before unused...
 | ||||||
|  | 									: ac == null ? | ||||||
|  | 										1 | ||||||
|  | 									: bc == null ? | ||||||
| 										-1 | 										-1 | ||||||
| 									// sort by position...
 | 									// keep position...
 | ||||||
| 									: a[0] - b[0]  | 									: a[0] - b[0] ) }) }) | ||||||
| 							}) }) |  | ||||||
| 					.map(function(tag){ | 					.map(function(tag){ | ||||||
| 						// normalize...
 | 						// normalize...
 | ||||||
| 						var count = tag[2] | 						var count = tag[2] | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user