mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-30 19:00:09 +00:00 
			
		
		
		
	tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									f3dc41130b
								
							
						
					
					
						commit
						3dbb59c1e6
					
				| @ -1496,11 +1496,24 @@ object.makeConstructor('BaseTags', | |||||||
| var TagsWithHandlersPrototype = { | var TagsWithHandlersPrototype = { | ||||||
| 	__proto__: BaseTagsPrototype, | 	__proto__: BaseTagsPrototype, | ||||||
| 
 | 
 | ||||||
|  | 	// Special tag handlers...
 | ||||||
| 	//
 | 	//
 | ||||||
| 	// Example handlers:
 | 	// Example handlers:
 | ||||||
| 	// 	{
 | 	// 	{
 | ||||||
|  | 	//		// print the tag operation info...
 | ||||||
|  | 	//		//
 | ||||||
|  | 	//		// NOTE: the key here is not a normalized tag thus this will 
 | ||||||
|  | 	//		//		never get called directly...
 | ||||||
|  | 	//		'PrintTag': function(tag, action, ...other){
 | ||||||
|  | 	//			console.log('TAG:', action, tag, ...other) },
 | ||||||
|  | 	//
 | ||||||
|  | 	//		// alias...
 | ||||||
|  | 	//		'*': 'PrintTag',
 | ||||||
|  | 	//
 | ||||||
| 	//		// remove the 'test' tag...
 | 	//		// remove the 'test' tag...
 | ||||||
| 	//		//
 | 	//		//
 | ||||||
|  | 	//		// NOTE: we can return a new value for the tag, if a handler
 | ||||||
|  | 	//		//		returns null or undefined the tag will not get changed...
 | ||||||
| 	//		'test': function(tag, action, ...other){
 | 	//		'test': function(tag, action, ...other){
 | ||||||
| 	//		    return this.removeTag('test', tag)[0] },
 | 	//		    return this.removeTag('test', tag)[0] },
 | ||||||
| 	//
 | 	//
 | ||||||
| @ -1511,20 +1524,22 @@ var TagsWithHandlersPrototype = { | |||||||
| 	//		'stop': function(tag, action, ...other){
 | 	//		'stop': function(tag, action, ...other){
 | ||||||
| 	//			return false },
 | 	//			return false },
 | ||||||
| 	//
 | 	//
 | ||||||
| 	//		// print the tag operation info...
 |  | ||||||
| 	//		//
 |  | ||||||
| 	//		'*': function(tag, action, ...other){
 |  | ||||||
| 	//			console.log('TAG:', action, tag, ...other)
 |  | ||||||
| 	//			return tag },
 |  | ||||||
| 	//
 |  | ||||||
| 	//		...
 | 	//		...
 | ||||||
| 	//	}
 | 	//	}
 | ||||||
| 	//
 | 	//
 | ||||||
| 	__special_tag_handlers__: null, | 	//__special_tag_handlers__: null,
 | ||||||
|  | 	__special_tag_handlers__: { | ||||||
|  | 	 	//'PrintTag': function(tag, action, ...other){
 | ||||||
|  | 	 	//	console.log('TAG:', action, tag, ...other) },
 | ||||||
|  | 		//'*': 'PrintTag',
 | ||||||
|  | 	}, | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | 	// Call the matching special tag handlers...
 | ||||||
|  | 	//
 | ||||||
| 	// NOTE: handlers are called in order of handler occurrence and not 
 | 	// NOTE: handlers are called in order of handler occurrence and not 
 | ||||||
| 	// 		in the order the tags are in the given chain/path...
 | 	// 		in the order the tags are in the given chain/path...
 | ||||||
|  | 	// NOTE: if no handlers are defined this is a no-op (almost)
 | ||||||
| 	handleSpecialTag: function(tags, ...args){ | 	handleSpecialTag: function(tags, ...args){ | ||||||
| 		var that = this | 		var that = this | ||||||
| 		var handlers = this.__special_tag_handlers__ || {} | 		var handlers = this.__special_tag_handlers__ || {} | ||||||
| @ -1556,8 +1571,13 @@ var TagsWithHandlersPrototype = { | |||||||
| 					// call the handlers...
 | 					// call the handlers...
 | ||||||
| 					// NOTE: we are threading tag through the handlers...
 | 					// NOTE: we are threading tag through the handlers...
 | ||||||
| 					.reduce(function(tag, handler){ | 					.reduce(function(tag, handler){ | ||||||
| 						return tag  | 						// update the returned tag in case we stop prematurely...
 | ||||||
| 							&& handler.call(that, tag, ...args) }, tags)  | 						tags = tag || tags | ||||||
|  | 						// if tag is falsy then stop handling... 
 | ||||||
|  | 						var cur = tag  | ||||||
|  | 							&& handler.call(that, tag, ...args) | ||||||
|  | 						// if a handler returned null continue with tag as-is...
 | ||||||
|  | 						return cur == null ? tag : cur }, tags)  | ||||||
| 				// no handlers -> return as-is...
 | 				// no handlers -> return as-is...
 | ||||||
| 				|| tags) }, | 				|| tags) }, | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user