mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-30 19:00:09 +00:00 
			
		
		
		
	added better path/url escaping/quoting...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									b62fb42f7b
								
							
						
					
					
						commit
						83ea854e5c
					
				| @ -24,6 +24,9 @@ if(typeof(sha1) != 'undefined'){ | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| /*********************************************************************/ | /*********************************************************************/ | ||||||
| 
 | 
 | ||||||
| // A stub image, also here for documentation...
 | // A stub image, also here for documentation...
 | ||||||
|  | |||||||
| @ -21,6 +21,26 @@ var IMAGE = '.image:not(.clone)' | |||||||
| var RIBBON = '.ribbon:not(.clone)' | var RIBBON = '.ribbon:not(.clone)' | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | /*********************************************************************/ | ||||||
|  | 
 | ||||||
|  | function path2url(path){ | ||||||
|  | 	// test if we have a schema, and if yes return as-is...
 | ||||||
|  | 	if(/^(http|https|file|[\w-]*):[\\\/]{2}/.test(path)){ | ||||||
|  | 		return path | ||||||
|  | 	} | ||||||
|  | 	// skip encoding windows drives...
 | ||||||
|  | 	var drive = path.split(/^([a-z]:[\\\/])/i) | ||||||
|  | 	path = drive.pop() | ||||||
|  | 	drive = drive.pop() || '' | ||||||
|  | 	return drive + (path | ||||||
|  | 		.split(/[\\\/]/g) | ||||||
|  | 		.map(encodeURIComponent) | ||||||
|  | 		.join('/')) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| /*********************************************************************/ | /*********************************************************************/ | ||||||
| //
 | //
 | ||||||
| // This expects the following HTML structure...
 | // This expects the following HTML structure...
 | ||||||
| @ -1107,6 +1127,7 @@ var RibbonsPrototype = { | |||||||
| 		return image | 		return image | ||||||
| 	}, | 	}, | ||||||
| 	_loadImagePreviewURL: function(image, url){ | 	_loadImagePreviewURL: function(image, url){ | ||||||
|  | 		url = path2url(url) | ||||||
| 		// pre-cache and load image...
 | 		// pre-cache and load image...
 | ||||||
| 		// NOTE: this will make images load without a blackout...
 | 		// NOTE: this will make images load without a blackout...
 | ||||||
| 		var img = new Image() | 		var img = new Image() | ||||||
| @ -1243,7 +1264,8 @@ var RibbonsPrototype = { | |||||||
| 			if(old_gid != gid  | 			if(old_gid != gid  | ||||||
| 					// the new preview (p_url) is different to current...
 | 					// the new preview (p_url) is different to current...
 | ||||||
| 					// NOTE: this may not work correctly for relative urls...
 | 					// NOTE: this may not work correctly for relative urls...
 | ||||||
| 					|| image.css('background-image').indexOf(encodeURI(p_url)) < 0){ | 					//|| image.css('background-image').indexOf(encodeURI(p_url)) < 0){
 | ||||||
|  | 					|| image.css('background-image').indexOf(path2url(p_url)) < 0){ | ||||||
| 				// sync load...
 | 				// sync load...
 | ||||||
| 				if(sync){ | 				if(sync){ | ||||||
| 					that._loadImagePreviewURL(image, p_url) | 					that._loadImagePreviewURL(image, p_url) | ||||||
|  | |||||||
| @ -4089,11 +4089,12 @@ module.AppControl = ImageGridFeatures.Feature({ | |||||||
| 	handlers: [ | 	handlers: [ | ||||||
| 		['start', | 		['start', | ||||||
| 			function(){  | 			function(){  | ||||||
| 				this.restoreWindowGeometry() |  | ||||||
| 
 |  | ||||||
| 				// XXX this messes up ribbon scale...
 | 				// XXX this messes up ribbon scale...
 | ||||||
| 				// 		...to close/fast?
 | 				// 		...to close/fast?
 | ||||||
| 				//this.toggleInterfaceScale('!')
 | 				//this.toggleInterfaceScale('!')
 | ||||||
|  | 				 | ||||||
|  | 				this.restoreWindowGeometry() | ||||||
|  | 
 | ||||||
| 			}], | 			}], | ||||||
| 		[[ | 		[[ | ||||||
| 			'close.pre', | 			'close.pre', | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user