mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	cleanup and minor tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									d5a0aa8368
								
							
						
					
					
						commit
						0527983e49
					
				| @ -1892,49 +1892,6 @@ var BaseBrowserPrototype = { | |||||||
| 					stop([func(elem, i, path)]) },  | 					stop([func(elem, i, path)]) },  | ||||||
| 				options) ].flat()[0] }, | 				options) ].flat()[0] }, | ||||||
| 
 | 
 | ||||||
| 	// 	
 |  | ||||||
| 	// 	Get parent of .focused
 |  | ||||||
| 	// 	.parentOf()
 |  | ||||||
| 	// 	.parentOf('focused'[, ..])
 |  | ||||||
| 	// 		-> parent
 |  | ||||||
| 	// 		-> this
 |  | ||||||
| 	// 		-> undefined
 |  | ||||||
| 	//
 |  | ||||||
| 	// 	Get parent of elem
 |  | ||||||
| 	// 	.parentOf(elem[, ..])
 |  | ||||||
| 	// 		-> parent
 |  | ||||||
| 	// 		-> this
 |  | ||||||
| 	// 		-> undefined
 |  | ||||||
| 	//
 |  | ||||||
| 	//
 |  | ||||||
| 	// Return values:
 |  | ||||||
| 	// 	- element		- actual parent element
 |  | ||||||
| 	// 	- this			- input element is at root of browser
 |  | ||||||
| 	// 	- undefined		- element not found
 |  | ||||||
| 	//
 |  | ||||||
| 	//
 |  | ||||||
| 	// NOTE: this is signature compatible with .get(..) see that for more
 |  | ||||||
| 	// 		docs...
 |  | ||||||
| 	//
 |  | ||||||
| 	// XXX should this be a part of .get(..)???
 |  | ||||||
| 	parentOf: function(item, options){ |  | ||||||
| 		var that = this |  | ||||||
| 		item = item || this.focused |  | ||||||
| 
 |  | ||||||
| 		var fargs = [...arguments].slice(1) |  | ||||||
| 		var args = fargs[0] instanceof Function ? |  | ||||||
| 			fargs.slice(1) |  | ||||||
| 			: fargs |  | ||||||
| 
 |  | ||||||
| 		return item ? |  | ||||||
| 			this.get(item,  |  | ||||||
| 				function(e, i, p){  |  | ||||||
| 					return p.length > 1 ? |  | ||||||
| 						that.get(p.slice(0, -1), ...fargs) |  | ||||||
| 			   			: that },  |  | ||||||
| 				...args)  |  | ||||||
| 			: undefined }, |  | ||||||
| 
 |  | ||||||
| 	// Sublist map functions...
 | 	// Sublist map functions...
 | ||||||
| 	// XXX this does not include inlined sections, should it???
 | 	// XXX this does not include inlined sections, should it???
 | ||||||
| 	sublists: function(func, options){ | 	sublists: function(func, options){ | ||||||
| @ -1972,9 +1929,39 @@ var BaseBrowserPrototype = { | |||||||
| 		return context.result | 		return context.result | ||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| 	// XXX should this return a path or a <path>:<count> ad in .index ???
 | 	// 	
 | ||||||
|  | 	// 	Get parent of .focused
 | ||||||
|  | 	// 	.parentOf()
 | ||||||
|  | 	// 	.parentOf('focused'[, ..])
 | ||||||
|  | 	// 		-> parent
 | ||||||
|  | 	// 		-> this
 | ||||||
|  | 	// 		-> undefined
 | ||||||
|  | 	//
 | ||||||
|  | 	// 	Get parent of elem
 | ||||||
|  | 	// 	.parentOf(elem[, ..])
 | ||||||
|  | 	// 		-> parent
 | ||||||
|  | 	// 		-> this
 | ||||||
|  | 	// 		-> undefined
 | ||||||
|  | 	//
 | ||||||
|  | 	//
 | ||||||
|  | 	// Return values:
 | ||||||
|  | 	// 	- element		- actual parent element
 | ||||||
|  | 	// 	- this			- input element is at root of browser
 | ||||||
|  | 	// 	- undefined		- element not found
 | ||||||
|  | 	//
 | ||||||
|  | 	//
 | ||||||
|  | 	// NOTE: this is signature compatible with .get(..) see that for more
 | ||||||
|  | 	// 		docs...
 | ||||||
|  | 	parentOf: function(item, options){ | ||||||
|  | 		item = item == null ? this.focused : item | ||||||
|  | 		if(item == null){ | ||||||
|  | 			return undefined } | ||||||
|  | 		var path = this.pathOf(item) | ||||||
|  | 		return path.length == 1 ? | ||||||
|  | 			this | ||||||
|  | 			: this.get(path.slice(0, -1), options) }, | ||||||
| 	positionOf: function(item, options){ | 	positionOf: function(item, options){ | ||||||
| 		return this.search(item,  | 		return this.search(item == null ? this.focused : item,  | ||||||
| 			function(_, i, p){  | 			function(_, i, p){  | ||||||
| 				return [i, p] },  | 				return [i, p] },  | ||||||
| 			Object.assign( | 			Object.assign( | ||||||
| @ -1988,6 +1975,7 @@ var BaseBrowserPrototype = { | |||||||
| 	pathOf: function(item, options){ | 	pathOf: function(item, options){ | ||||||
| 		return this.positionOf(item, options)[1] }, | 		return this.positionOf(item, options)[1] }, | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| 	// Like .select(.., {iterateCollapsed: true}) but will expand all the 
 | 	// Like .select(.., {iterateCollapsed: true}) but will expand all the 
 | ||||||
| 	// path items to reveal the target...
 | 	// path items to reveal the target...
 | ||||||
| 	// XXX should this return the matched item(s), expanded item(s) or this???
 | 	// XXX should this return the matched item(s), expanded item(s) or this???
 | ||||||
| @ -3030,9 +3018,7 @@ var BrowserPrototype = { | |||||||
| 		//
 | 		//
 | ||||||
| 		// XXX can we make this relative???
 | 		// XXX can we make this relative???
 | ||||||
| 		// 		...i.e. about half of the average element height...
 | 		// 		...i.e. about half of the average element height...
 | ||||||
| 		// XXX use this for page up/down???
 | 		focusOffsetWhileScrolling: 18, | ||||||
| 		// XXX needs more tweaking...
 |  | ||||||
| 		focusOffsetWhileScrolling: 15, |  | ||||||
| 
 | 
 | ||||||
| 		hideListHeader: false, | 		hideListHeader: false, | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user