mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	reworked the widget.close event workings, now alot more uniform...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									6a7f440bc7
								
							
						
					
					
						commit
						096fb9957e
					
				| @ -312,9 +312,9 @@ var BrowserPrototype = { | ||||
| 			'select', | ||||
| 			'deselect', | ||||
| 
 | ||||
| 			//'keydown',
 | ||||
| 			'keydown', | ||||
| 
 | ||||
| 			'close', | ||||
| 			//'close',
 | ||||
| 		], | ||||
| 
 | ||||
| 		// Shorthand elements...
 | ||||
| @ -1140,7 +1140,7 @@ var BrowserPrototype = { | ||||
| 				hidden ? 'hidden' : '', | ||||
| 				opts.hide_on_search ? 'hide-on-search' : '', | ||||
| 				(opts.hide_on_search || opts.not_searchable) ? 'not-searchable' : '', | ||||
| 				opts.not_filtered_out ? 'not_filtered_out' : '', | ||||
| 				opts.not_filtered_out ? 'not-filtered-out' : '', | ||||
| 			].join(' ')) | ||||
| 
 | ||||
| 			opts.push_on_open && res.attr('push-on-open', 'on') | ||||
| @ -1520,7 +1520,7 @@ var BrowserPrototype = { | ||||
| 			this.filter(pattern, | ||||
| 					// rejected...
 | ||||
| 					function(i, e){ | ||||
| 						!e.hasClass('not-filterd-out') | ||||
| 						!e.hasClass('not-filtered-out') | ||||
| 							&& e.addClass('filtered-out') | ||||
| 
 | ||||
| 						e.removeClass('selected') | ||||
|  | ||||
| @ -71,23 +71,6 @@ var OverlayPrototype = { | ||||
| 		}, | ||||
| 	}, | ||||
| 
 | ||||
| 	// custom events...
 | ||||
| 	close: function(handler){ | ||||
| 		// trigger the event...
 | ||||
| 		if(handler == null){ | ||||
| 			this.dom.detach() | ||||
| 			if(this.parent.children('.overlay-widget').length == 0){ | ||||
| 				this.parent.removeClass('blur') | ||||
| 			} | ||||
| 			this.trigger('close') | ||||
| 
 | ||||
| 		// register a handler...
 | ||||
| 		} else { | ||||
| 			this.on('close', handler) | ||||
| 		} | ||||
| 		return this | ||||
| 	}, | ||||
| 
 | ||||
| 	__init__: function(parent, client, options){ | ||||
| 		var that = this | ||||
| 
 | ||||
| @ -128,10 +111,18 @@ var OverlayPrototype = { | ||||
| 			.addClass('blur') | ||||
| 			.append(this.dom) | ||||
| 
 | ||||
| 		// pass focus to the client if it is not focused already...
 | ||||
| 		this.on('focus click', function(){ | ||||
| 			client.focus && client.focus() | ||||
| 		}) | ||||
| 		this | ||||
| 			// pass focus to the client if it is not focused already...
 | ||||
| 			.on('focus click', function(){ | ||||
| 				client.focus && client.focus() | ||||
| 			}) | ||||
| 			// close...
 | ||||
| 			.close(function(){ | ||||
| 				that.dom.detach() | ||||
| 				if(that.parent.children('.overlay-widget').length == 0){ | ||||
| 					that.parent.removeClass('blur') | ||||
| 				} | ||||
| 			}) | ||||
| 
 | ||||
| 		this.focus() | ||||
| 
 | ||||
|  | ||||
| @ -85,6 +85,20 @@ var WidgetPrototype = { | ||||
| 	deligate: proxyToDom('deligate'), | ||||
| 	undeligate: proxyToDom('undeligate'), | ||||
| 
 | ||||
| 	// custom events...
 | ||||
| 	close: function(handler){ | ||||
| 		// trigger...
 | ||||
| 		if(handler == null){ | ||||
| 			this.parent.close  | ||||
| 				&& this.parent.close() | ||||
| 			this.trigger('close') | ||||
| 
 | ||||
| 		// register new handler...
 | ||||
| 		} else { | ||||
| 			this.on('close', handler) | ||||
| 		} | ||||
| 		return this | ||||
| 	}, | ||||
| 
 | ||||
| 	// XXX this will not:
 | ||||
| 	// 		- attach dom to parent... (???)
 | ||||
| @ -117,11 +131,12 @@ var WidgetPrototype = { | ||||
| 
 | ||||
| 		// add keyboard handler...
 | ||||
| 		if(this.keyboard && this.dom){ | ||||
| 			this.dom.keydown( | ||||
| 				keyboard.makeKeyboardHandler( | ||||
| 					this.keyboard, | ||||
| 					options.logKeys, | ||||
| 					this)) | ||||
| 			this.dom | ||||
| 				.keydown( | ||||
| 					keyboard.makeKeyboardHandler( | ||||
| 						this.keyboard, | ||||
| 						options.logKeys, | ||||
| 						this)) | ||||
| 		} | ||||
| 
 | ||||
| 		if(this.options.nonPropagatedEvents != null){ | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user