mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	bugfix + some refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									15ca09fed0
								
							
						
					
					
						commit
						3093e0e684
					
				| @ -771,6 +771,21 @@ var BaseBrowserPrototype = { | |||||||
| 		//skipDisabledMode: 'node',
 | 		//skipDisabledMode: 'node',
 | ||||||
| 
 | 
 | ||||||
| 		updateTimeout: 30, | 		updateTimeout: 30, | ||||||
|  | 
 | ||||||
|  | 		// Element templates...
 | ||||||
|  | 		//
 | ||||||
|  | 		// Format:
 | ||||||
|  | 		// 	{
 | ||||||
|  | 		// 		<key>: <item>,
 | ||||||
|  | 		// 		...
 | ||||||
|  | 		// 	}
 | ||||||
|  | 		//
 | ||||||
|  | 		// If make(..) gets passed <key> it will construct the base element
 | ||||||
|  | 		// via <item> and merge the item options into that.
 | ||||||
|  | 		//
 | ||||||
|  | 		// <item> format is the same as the format passed to make(..)
 | ||||||
|  | 		elementTemplate: { | ||||||
|  | 		}, | ||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -1187,8 +1202,10 @@ var BaseBrowserPrototype = { | |||||||
| 
 | 
 | ||||||
| 				// build the item...
 | 				// build the item...
 | ||||||
| 				var item = new this.__item__( | 				var item = new this.__item__( | ||||||
| 					// XXX do we need this???
 | 					// populate the element from template, if present...
 | ||||||
| 					//options || {}, 
 | 					opts.value in (options.elementTemplate || {}) ? | ||||||
|  | 						options.elementTemplate[opts.value] | ||||||
|  | 						: {},	 | ||||||
| 					opts, | 					opts, | ||||||
| 					{ parent: this }) | 					{ parent: this }) | ||||||
| 
 | 
 | ||||||
| @ -3295,25 +3312,7 @@ var HTMLBrowserPrototype = { | |||||||
| 		headerItemButtons: [ | 		headerItemButtons: [ | ||||||
| 		], | 		], | ||||||
| 
 | 
 | ||||||
| 		// Shorthand elements...
 | 		elementTemplate: { | ||||||
| 		//
 |  | ||||||
| 		// Format:
 |  | ||||||
| 		// 	{
 |  | ||||||
| 		// 		<key>: {
 |  | ||||||
| 		// 			class: <element-class-str>,
 |  | ||||||
| 		// 			html: <element-html-str>,
 |  | ||||||
| 		// 		},
 |  | ||||||
| 		// 		...
 |  | ||||||
| 		// 	}
 |  | ||||||
| 		//
 |  | ||||||
| 		// If make(..) gets passed <key> it will construct and element
 |  | ||||||
| 		// via <element-html-str> with an optional <element-class-str>
 |  | ||||||
| 		//
 |  | ||||||
| 		// NOTE: .class is optional...
 |  | ||||||
| 		// NOTE: set this to null to disable shorthands...
 |  | ||||||
| 		// NOTE: currently the options in the template will override 
 |  | ||||||
| 		// 		anything explicitly given by item options... (XXX revise)
 |  | ||||||
| 		elementShorthand: { |  | ||||||
| 			'   ': { | 			'   ': { | ||||||
| 				'class': 'separator', | 				'class': 'separator', | ||||||
| 				'html': '<div/>', | 				'html': '<div/>', | ||||||
| @ -3791,11 +3790,8 @@ var HTMLBrowserPrototype = { | |||||||
| 			: (target.innerHTML = value) | 			: (target.innerHTML = value) | ||||||
| 			return target } | 			return target } | ||||||
| 
 | 
 | ||||||
| 		// special-case: item shorthands...
 | 		// special-case: item.html...
 | ||||||
| 		if(item.value in (options.elementShorthand || {})){ | 		if(item.html){ | ||||||
| 			// XXX need to merge and not overwrite -- revise...
 |  | ||||||
| 			Object.assign(item, options.elementShorthand[item.value]) |  | ||||||
| 
 |  | ||||||
| 			// NOTE: this is a bit of a cheat, but it saves us from either 
 | 			// NOTE: this is a bit of a cheat, but it saves us from either 
 | ||||||
| 			// 		parsing or restricting the format...
 | 			// 		parsing or restricting the format...
 | ||||||
| 			var tmp = document.createElement('div') | 			var tmp = document.createElement('div') | ||||||
| @ -3805,7 +3801,6 @@ var HTMLBrowserPrototype = { | |||||||
| 				...(item['class'] instanceof Array ? | 				...(item['class'] instanceof Array ? | ||||||
| 					item['class'] | 					item['class'] | ||||||
| 					: item['class'].split(/\s+/g))) | 					: item['class'].split(/\s+/g))) | ||||||
| 
 |  | ||||||
| 			return elem  | 			return elem  | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| @ -3847,7 +3842,9 @@ var HTMLBrowserPrototype = { | |||||||
| 
 | 
 | ||||||
| 		// values...
 | 		// values...
 | ||||||
| 		text != null | 		text != null | ||||||
| 			&& (item.value instanceof Array ? item.value : [item.value]) | 			&& (item.value instanceof Array ?  | ||||||
|  | 					item.value  | ||||||
|  | 					: [item.value]) | ||||||
| 				// handle $keys and other stuff...
 | 				// handle $keys and other stuff...
 | ||||||
| 				.map(function(v){ | 				.map(function(v){ | ||||||
| 					// handle key-shortcuts $K...
 | 					// handle key-shortcuts $K...
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user