mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-30 19:00:09 +00:00 
			
		
		
		
	some refactoring, cleanup and minor fixes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									c83a4f9ad3
								
							
						
					
					
						commit
						384450d75f
					
				| @ -197,15 +197,20 @@ | |||||||
| 
 | 
 | ||||||
| 	opacity: 0.4; | 	opacity: 0.4; | ||||||
| } | } | ||||||
|  | /* highlight seach... */ | ||||||
|  | .browse-widget .list>div .text b { | ||||||
|  | 	background-color: rgba(0, 0, 255, 0.5); | ||||||
|  | } | ||||||
| .browse-widget .list>div.strike-out .text { | .browse-widget .list>div.strike-out .text { | ||||||
| 	text-decoration: line-through; | 	text-decoration: line-through; | ||||||
| 	opacity: 0.3; | 	opacity: 0.3; | ||||||
| } | } | ||||||
| .browse-widget .list>div.highlighted { | .browse-widget .list>div.highlighted { | ||||||
| 	font-style: italic; | 	font-style: italic; | ||||||
|  | 	font-weight: bold; | ||||||
| } | } | ||||||
| .browse-widget .list>div.highlighted:after { | .browse-widget .list>div.highlighted .text:after { | ||||||
| 	content: '*'; | 	content: ' *'; | ||||||
| } | } | ||||||
| .browse-widget:not(.flat) .list div:not(.not-traversable) .text:after { | .browse-widget:not(.flat) .list div:not(.not-traversable) .text:after { | ||||||
| 	content: "/"; | 	content: "/"; | ||||||
|  | |||||||
| @ -65,6 +65,7 @@ function(path, make){ | |||||||
| var listDirfs =  | var listDirfs =  | ||||||
| module.listDirfs = | module.listDirfs = | ||||||
| function(path, make){ | function(path, make){ | ||||||
|  | 	var that = this | ||||||
| 	path = path.constructor == Array ? path.join('/') : path | 	path = path.constructor == Array ? path.join('/') : path | ||||||
| 	path = /^[a-zA-Z]:/.test(path.trim()) ? path : '/'+path | 	path = /^[a-zA-Z]:/.test(path.trim()) ? path : '/'+path | ||||||
| 	// XXX the windows root path must have a trailing '/'
 | 	// XXX the windows root path must have a trailing '/'
 | ||||||
| @ -127,7 +128,7 @@ function(path, make){ | |||||||
| 							// 		so we'll not wait...
 | 							// 		so we'll not wait...
 | ||||||
| 							if(res && dir){ | 							if(res && dir){ | ||||||
| 								var i = 0 | 								var i = 0 | ||||||
| 								glob(path +'/'+ file +'/*+(jpg|jpeg|png|JPG|JPEG|PNG)') | 								glob(path +'/'+ file +'/'+ that.options.fileCountPattern) | ||||||
| 									/* | 									/* | ||||||
| 									.on('match', function(){ | 									.on('match', function(){ | ||||||
| 										i += 1 | 										i += 1 | ||||||
| @ -231,6 +232,8 @@ WalkPrototype.options = { | |||||||
| 	pushButton: false, | 	pushButton: false, | ||||||
| 
 | 
 | ||||||
| 	list: listDir, | 	list: listDir, | ||||||
|  | 
 | ||||||
|  | 	fileCountPattern: '*+(jpg|jpeg|png|JPG|JPEG|PNG)', | ||||||
| } | } | ||||||
| WalkPrototype.options.__proto__ = browse.Browser.prototype.options | WalkPrototype.options.__proto__ = browse.Browser.prototype.options | ||||||
| 
 | 
 | ||||||
| @ -243,16 +246,30 @@ object.makeConstructor('Walk', | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| var makeWalk =  | var makeWalk =  | ||||||
| module.makeWalk = function(elem, path, showNonTraversable, showDisabled){ | module.makeWalk = function(elem, path, showNonTraversable, showDisabled, fileCountPattern, rest){ | ||||||
| 	var w = Walk(elem, {  | 	var opts = {} | ||||||
| 		path: path, | 	if(rest){ | ||||||
| 		showNonTraversable: showNonTraversable == null ? | 		for(var k in rest){ | ||||||
| 			WalkPrototype.options.showNonTraversable | 			opts[k] = rest[k] | ||||||
| 			: showNonTraversable, | 		} | ||||||
| 		showDisabled: showDisabled == null ?  | 	} | ||||||
| 			WalkPrototype.options.showDisabled | 
 | ||||||
| 			: showDisabled, | 	opts.path = path | ||||||
| 	}) | 
 | ||||||
|  | 	opts.showNonTraversable = showNonTraversable == null ? | ||||||
|  | 		WalkPrototype.options.showNonTraversable | ||||||
|  | 		: showNonTraversable | ||||||
|  | 
 | ||||||
|  | 	opts.showDisabled = showDisabled == null ?  | ||||||
|  | 		WalkPrototype.options.showDisabled | ||||||
|  | 		: showDisabled | ||||||
|  | 
 | ||||||
|  | 	opts.fileCountPattern = fileCountPattern == null ? | ||||||
|  | 		WalkPrototype.options.fileCountPattern | ||||||
|  | 		: fileCountPattern | ||||||
|  | 
 | ||||||
|  | 	var w = Walk(elem, opts) | ||||||
|  | 
 | ||||||
| 	return w | 	return w | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -3453,6 +3453,8 @@ function(path){ | |||||||
| var FileSystemLoaderActions = actions.Actions({ | var FileSystemLoaderActions = actions.Actions({ | ||||||
| 	config: { | 	config: { | ||||||
| 		'index-dir': '.ImageGrid', | 		'index-dir': '.ImageGrid', | ||||||
|  | 
 | ||||||
|  | 		'image-file-pattern': '*+(jpg|jpeg|png|JPG|JPEG|PNG)', | ||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| 	clone: [function(full){ | 	clone: [function(full){ | ||||||
| @ -3623,7 +3625,7 @@ var FileSystemLoaderActions = actions.Actions({ | |||||||
| 			// XXX not sure if this is the way to go...
 | 			// XXX not sure if this is the way to go...
 | ||||||
| 			this._base_path = path  | 			this._base_path = path  | ||||||
| 
 | 
 | ||||||
| 			glob(path + '/*+(jpg|jpeg|png|JPG|JPEG|PNG)') | 			glob(path + '/'+ this.config['image-file-pattern']) | ||||||
| 				.on('error', function(err){ | 				.on('error', function(err){ | ||||||
| 					console.log('!!!!', err) | 					console.log('!!!!', err) | ||||||
| 				}) | 				}) | ||||||
| @ -3663,7 +3665,7 @@ var FileSystemLoaderActions = actions.Actions({ | |||||||
| 			var base_pattern = RegExp('^'+path) | 			var base_pattern = RegExp('^'+path) | ||||||
| 
 | 
 | ||||||
| 			// find images...
 | 			// find images...
 | ||||||
| 			glob(path + '/*+(jpg|jpeg|png|JPG|JPEG|PNG)') | 			glob(path + '/'+ this.config['image-file-pattern']) | ||||||
| 				.on('end', function(lst){  | 				.on('end', function(lst){  | ||||||
| 					// create a new images chunk...
 | 					// create a new images chunk...
 | ||||||
| 					lst = lst | 					lst = lst | ||||||
| @ -3778,7 +3780,9 @@ var FileSystemLoaderUIActions = actions.Actions({ | |||||||
| 			base = base || this.base_path || '/' | 			base = base || this.base_path || '/' | ||||||
| 
 | 
 | ||||||
| 			var o = overlay.Overlay(this.ribbons.viewer,  | 			var o = overlay.Overlay(this.ribbons.viewer,  | ||||||
| 				require('./lib/widget/browse-walk').makeWalk(null, base, false, false) | 				require('./lib/widget/browse-walk').makeWalk( | ||||||
|  | 						null, base, false, false,  | ||||||
|  | 						this.config['image-file-pattern']) | ||||||
| 					// path selected...
 | 					// path selected...
 | ||||||
| 					.open(function(evt, path){  | 					.open(function(evt, path){  | ||||||
| 						var item = o.client.selected | 						var item = o.client.selected | ||||||
| @ -4186,7 +4190,7 @@ var URLHistoryUIActions = actions.Actions({ | |||||||
| 			var makeRE = function(path){ | 			var makeRE = function(path){ | ||||||
| 				return RegExp('^' | 				return RegExp('^' | ||||||
| 					// quote regular expression chars...
 | 					// quote regular expression chars...
 | ||||||
| 					+p.replace(/([\.\\\/\(\)\[\]\$\*\+\-\{\}\@\^\&\?\<\>])/g, '\\$1') | 					+path.replace(/([\.\\\/\(\)\[\]\$\*\+\-\{\}\@\^\&\?\<\>])/g, '\\$1') | ||||||
| 					+'$') | 					+'$') | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user