mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	not .open(..) is signature-compatible with .select(..) + # keys not trigger a push rather than select...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									4bf8b54ea9
								
							
						
					
					
						commit
						16b10e9bd7
					
				| @ -214,15 +214,19 @@ var BrowserPrototype = { | |||||||
| 				ctrl: 'startFullPathEdit!', | 				ctrl: 'startFullPathEdit!', | ||||||
| 			}, | 			}, | ||||||
| 
 | 
 | ||||||
| 			'#1': 'select: "0!"', | 			// XXX should these be select???
 | ||||||
| 			'#2': 'select: "1!"', | 			// XXX should these be relative to visible area or absolute 
 | ||||||
| 			'#3': 'select: "2!"', | 			// 		to current list regardless of scroll (as is now)???
 | ||||||
| 			'#4': 'select: "3!"', | 			// XXX should these work while filtering??
 | ||||||
| 			'#5': 'select: "4!"', | 			'#1': 'push: "0!"', | ||||||
| 			'#6': 'select: "5!"', | 			'#2': 'push: "1!"', | ||||||
| 			'#7': 'select: "6!"', | 			'#3': 'push: "2!"', | ||||||
| 			'#8': 'select: "7!"', | 			'#4': 'push: "3!"', | ||||||
| 			'#9': 'select: "8!"', | 			'#5': 'push: "4!"', | ||||||
|  | 			'#6': 'push: "5!"', | ||||||
|  | 			'#7': 'push: "6!"', | ||||||
|  | 			'#8': 'push: "7!"', | ||||||
|  | 			'#9': 'push: "8!"', | ||||||
| 		}, | 		}, | ||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| @ -1080,12 +1084,18 @@ var BrowserPrototype = { | |||||||
| 	//
 | 	//
 | ||||||
| 	// XXX might be a good idea to add a live traversable check...
 | 	// XXX might be a good idea to add a live traversable check...
 | ||||||
| 	// XXX revise event...
 | 	// XXX revise event...
 | ||||||
| 	push: function(elem){ | 	push: function(pattern){ | ||||||
| 		var browser = this.dom  | 		var browser = this.dom  | ||||||
| 		var elem = this.select(elem || '!') | 		var cur = this.select('!') | ||||||
|  | 		var elem = this.select(pattern || '!') | ||||||
|  | 
 | ||||||
|  | 		// item not found...
 | ||||||
|  | 		if(elem.length == 0 && pattern != null){ | ||||||
|  | 			return this | ||||||
|  | 		} | ||||||
| 
 | 
 | ||||||
| 		// nothing selected, select first and exit...
 | 		// nothing selected, select first and exit...
 | ||||||
| 		if(elem.length == 0){ | 		if(cur.length == 0 && elem.length == 0){ | ||||||
| 			this.select() | 			this.select() | ||||||
| 			return this | 			return this | ||||||
| 		} | 		} | ||||||
| @ -1174,6 +1184,8 @@ var BrowserPrototype = { | |||||||
| 	// By default this only triggers the 'open' event on both the browser
 | 	// By default this only triggers the 'open' event on both the browser
 | ||||||
| 	// and the selected element if one exists.
 | 	// and the selected element if one exists.
 | ||||||
| 	//
 | 	//
 | ||||||
|  | 	// This is signature compatible with .select(..) but adds support 
 | ||||||
|  | 	// for full paths.
 | ||||||
| 	//
 | 	//
 | ||||||
| 	// NOTE: if nothing is selected this will do nothing...
 | 	// NOTE: if nothing is selected this will do nothing...
 | ||||||
| 	// NOTE: internally this is never called directly, instead a pre-open
 | 	// NOTE: internally this is never called directly, instead a pre-open
 | ||||||
| @ -1182,8 +1194,6 @@ var BrowserPrototype = { | |||||||
| 	// NOTE: unlike .list(..) this can be used directly if an item is 
 | 	// NOTE: unlike .list(..) this can be used directly if an item is 
 | ||||||
| 	// 		selected and an actual open action is defined, either in an
 | 	// 		selected and an actual open action is defined, either in an
 | ||||||
| 	// 		instance or in .options
 | 	// 		instance or in .options
 | ||||||
| 	//
 |  | ||||||
| 	// XXX should this be select-compatible???
 |  | ||||||
| 	open: function(path){  | 	open: function(path){  | ||||||
| 		var elem = this.select('!') | 		var elem = this.select('!') | ||||||
| 
 | 
 | ||||||
| @ -1200,11 +1210,23 @@ var BrowserPrototype = { | |||||||
| 			path.push(elem.text()) | 			path.push(elem.text()) | ||||||
| 
 | 
 | ||||||
| 		// normalize and load path...
 | 		// normalize and load path...
 | ||||||
| 		} else { | 		//} else {
 | ||||||
|  | 		} else if(path.constructor == Array || /[\\\/]/.test(path)) { | ||||||
| 			path = this.path2lst(path) | 			path = this.path2lst(path) | ||||||
| 			var elem = path.slice(-1)[0] | 			var elem = path.slice(-1)[0] | ||||||
| 			this.path = path.slice(0, -1) | 			this.path = path.slice(0, -1) | ||||||
| 			elem = this.select(elem) | 			elem = this.select(elem) | ||||||
|  | 
 | ||||||
|  | 		// select-compatible -- select from current context...	
 | ||||||
|  | 		} else { | ||||||
|  | 			elem = this.select(path) | ||||||
|  | 
 | ||||||
|  | 			if(elem.length == 0){ | ||||||
|  | 				return this | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			path = this.path | ||||||
|  | 			path.push(elem.text()) | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		// get the options method and call it if it exists...
 | 		// get the options method and call it if it exists...
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user