mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-11-04 05:10:07 +00:00 
			
		
		
		
	added history list url checking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									86a77e5937
								
							
						
					
					
						commit
						0a30e253c5
					
				@ -3416,6 +3416,7 @@ module.AppControl = ImageGridFeatures.Feature({
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// XXX at this point this is a stub...
 | 
					// XXX at this point this is a stub...
 | 
				
			||||||
if(window.nodejs != null){
 | 
					if(window.nodejs != null){
 | 
				
			||||||
 | 
						var fse = requirejs('fs-extra')
 | 
				
			||||||
	var glob = requirejs('glob')
 | 
						var glob = requirejs('glob')
 | 
				
			||||||
	var file = requirejs('./file')
 | 
						var file = requirejs('./file')
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -3488,6 +3489,12 @@ var FileSystemLoaderActions = actions.Actions({
 | 
				
			|||||||
	},
 | 
						},
 | 
				
			||||||
	loaded_paths: null,
 | 
						loaded_paths: null,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// XXX is this a hack???
 | 
				
			||||||
 | 
						// XXX need a more generic form...
 | 
				
			||||||
 | 
						checkPath: ['File/',
 | 
				
			||||||
 | 
							function(path){ return fse.existsSync(path) }],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// NOTE: when passed no path this will not do anything...
 | 
						// NOTE: when passed no path this will not do anything...
 | 
				
			||||||
	// XXX should this set something like .path???
 | 
						// XXX should this set something like .path???
 | 
				
			||||||
	// 		...and how should this be handled when merging indexes or
 | 
						// 		...and how should this be handled when merging indexes or
 | 
				
			||||||
@ -3966,11 +3973,11 @@ var URLHistoryActions = actions.Actions({
 | 
				
			|||||||
			if(url && this.url_history[url] && this.url_history[url].check){
 | 
								if(url && this.url_history[url] && this.url_history[url].check){
 | 
				
			||||||
				var check = this.url_history[url].check
 | 
									var check = this.url_history[url].check
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if(check instanceof Function){
 | 
									if(typeof(check) == typeof('str')){
 | 
				
			||||||
					return check(url)
 | 
										return this[check](url)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					return this[check](url)
 | 
										return check(url)
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// no way to check so we do not know...
 | 
								// no way to check so we do not know...
 | 
				
			||||||
@ -4112,9 +4119,10 @@ module.URLHistoryLocalStorage = ImageGridFeatures.Feature({
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// NOTE: loading is done by the .url_history prop...
 | 
						// NOTE: loading is done by the .url_history prop...
 | 
				
			||||||
	handlers: [
 | 
						handlers: [
 | 
				
			||||||
		// XXX not sure if we need this...
 | 
							// save base_path...
 | 
				
			||||||
		['load loadURLs', 
 | 
							['load loadURLs', 
 | 
				
			||||||
			function(){ this.base_path && this.saveBasePath() }],
 | 
								function(){ this.base_path && this.saveBasePath() }],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// save...
 | 
							// save...
 | 
				
			||||||
		['pushURLToHistory dropURLFromHistory setTopURLHistory', 
 | 
							['pushURLToHistory dropURLFromHistory setTopURLHistory', 
 | 
				
			||||||
			function(){ 
 | 
								function(){ 
 | 
				
			||||||
@ -4232,12 +4240,18 @@ var URLHistoryUIActions = actions.Actions({
 | 
				
			|||||||
						&& parent.focus()
 | 
											&& parent.focus()
 | 
				
			||||||
				})
 | 
									})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								var list = o.client
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								Object.keys(this.url_history).reverse().forEach(function(p){
 | 
				
			||||||
 | 
									that.checkURLFromHistory(p) || list.filter(p).addClass('disabled')
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// select and highlight current path...
 | 
								// select and highlight current path...
 | 
				
			||||||
			cur && o.client
 | 
								cur && list
 | 
				
			||||||
				.select(cur)
 | 
									.select(cur)
 | 
				
			||||||
					.addClass('highlighted')
 | 
										.addClass('highlighted')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			return o.client
 | 
								return list
 | 
				
			||||||
		}],
 | 
							}],
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -4259,12 +4273,15 @@ module.URLHistoryUI = ImageGridFeatures.Feature({
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//---------------------------------------------------------------------
 | 
					//---------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var pushToHistory = function(action, to_top){
 | 
					var pushToHistory = function(action, to_top, checker){
 | 
				
			||||||
	return [action, 
 | 
						return [action, 
 | 
				
			||||||
		function(_, path){ 
 | 
							function(_, path){ 
 | 
				
			||||||
			path = normalizePath(path)
 | 
								path = normalizePath(path)
 | 
				
			||||||
			if(path){
 | 
								if(path){
 | 
				
			||||||
				this.pushURLToHistory(normalizePath(path), action) 
 | 
									this.pushURLToHistory(
 | 
				
			||||||
 | 
										normalizePath(path), 
 | 
				
			||||||
 | 
										action, 
 | 
				
			||||||
 | 
										checker || 'checkPath') 
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if(to_top){
 | 
								if(to_top){
 | 
				
			||||||
				this.setTopURLHistory(path)
 | 
									this.setTopURLHistory(path)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user