mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	more work on filenames...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									0d3ea59f40
								
							
						
					
					
						commit
						5b4c7353ef
					
				| @ -142,6 +142,26 @@ function(data){ | |||||||
| } | } | ||||||
| */ | */ | ||||||
| 
 | 
 | ||||||
|  | /* XXX we do not have a ref to images... | ||||||
|  | module.VERSIONS['3.1'] = | ||||||
|  | function(data){ | ||||||
|  | 	res = module.VERSIONS['3.0'](data) | ||||||
|  | 
 | ||||||
|  | 	res.version = '3.1' | ||||||
|  | 
 | ||||||
|  | 	// XXX we do not have a ref to images here...
 | ||||||
|  | 	Object.values(res.images || {}) | ||||||
|  | 		.forEach(function(img){ | ||||||
|  | 			Object.keys(img.preview) | ||||||
|  | 				.forEach(function(res){ | ||||||
|  | 					var p = img.preview[res] | ||||||
|  | 					img.preview[res] = p.indexOf('%20') >= 0 ? decodeURI(p) : p | ||||||
|  | 				}) | ||||||
|  | 		}) | ||||||
|  | 
 | ||||||
|  | 	return res | ||||||
|  | } | ||||||
|  | //*/
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| // Get latest updater version...
 | // Get latest updater version...
 | ||||||
|  | |||||||
| @ -351,6 +351,9 @@ module.ImagesClassPrototype = { | |||||||
| 
 | 
 | ||||||
| var ImagesPrototype = | var ImagesPrototype = | ||||||
| module.ImagesPrototype = { | module.ImagesPrototype = { | ||||||
|  | 	//version: '3.1',
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 	get length(){ | 	get length(){ | ||||||
| 		return Object.keys(this).length }, | 		return Object.keys(this).length }, | ||||||
| 
 | 
 | ||||||
| @ -500,6 +503,10 @@ module.ImagesPrototype = { | |||||||
| 				url = previews[k] | 				url = previews[k] | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | 
 | ||||||
|  | 		// XXX LEGACY...
 | ||||||
|  | 		//url = url.indexOf('%20') >= 0 ? decodeURI(url) : url
 | ||||||
|  | 
 | ||||||
| 		return { | 		return { | ||||||
| 			url: (full_path && img_data.base_path ? | 			url: (full_path && img_data.base_path ? | ||||||
| 				  	img_data.base_path + '/'  | 				  	img_data.base_path + '/'  | ||||||
| @ -698,15 +705,31 @@ module.ImagesPrototype = { | |||||||
| 		data = typeof(data) == typeof('str')  | 		data = typeof(data) == typeof('str')  | ||||||
| 			? JSON.parse(data)  | 			? JSON.parse(data)  | ||||||
| 			: JSON.parse(JSON.stringify(data)) | 			: JSON.parse(JSON.stringify(data)) | ||||||
|  | 		var version = data.versio | ||||||
| 		for(var k in data){ | 		for(var k in data){ | ||||||
| 			this[k] = data[k] | 			var img = this[k] = data[k] | ||||||
|  | 
 | ||||||
|  | 			// keep the preview paths decoded...
 | ||||||
|  | 			//
 | ||||||
|  | 			// NOTE: updating from legacy format...
 | ||||||
|  | 			// XXX move this to version conversion... (???)
 | ||||||
|  | 			if(version == null){ | ||||||
|  | 				Object.keys(img && img.preview || {}) | ||||||
|  | 					.forEach(function(res){ | ||||||
|  | 						var p = img.preview[res] | ||||||
|  | 						img.preview[res] = p.indexOf(k+'%20-%20') >= 0 ? decodeURI(p) : p | ||||||
|  | 					}) | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 		return this | 		return this | ||||||
| 	}, | 	}, | ||||||
| 	// XXX this is really odd: renaming this to 'toJSON' breaks JavasCript
 | 	// XXX this is really odd: renaming this to 'toJSON' breaks JavaScript
 | ||||||
| 	// 		making chrome/node just say: "<error>" and a filename...
 | 	// 		making chrome/node just say: "<error>" and a filename...
 | ||||||
| 	dumpJSON: function(data){ | 	dumpJSON: function(data){ | ||||||
| 		return JSON.parse(JSON.stringify(this)) | 		var res = JSON.parse(JSON.stringify(this)) | ||||||
|  | 		// XXX
 | ||||||
|  | 		res.version = '3.0' | ||||||
|  | 		return res | ||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| 	_reset: function(){ | 	_reset: function(){ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user