mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	some refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									583d196c87
								
							
						
					
					
						commit
						dacfdf6192
					
				
							
								
								
									
										17
									
								
								ui/data.js
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								ui/data.js
									
									
									
									
									
								
							| @ -109,12 +109,13 @@ var IMAGES_CREATED = false | |||||||
| 
 | 
 | ||||||
| var MARKED = [] | var MARKED = [] | ||||||
| 
 | 
 | ||||||
|  | // NOTE: these are named: <mode>-<feature>
 | ||||||
| var SETTINGS = { | var SETTINGS = { | ||||||
| 	'theme': null, | 	'global-theme': null, | ||||||
| 	'screen-images-ribbon-mode': null, | 	'ribbon-mode-screen-images': null, | ||||||
| 	'screen-images-single-image-mode': null, | 	'single-image-mode-screen-images': null, | ||||||
| 	'single-image-mode-proportions': null, | 	'single-image-mode-proportions': null, | ||||||
| 	'image-info-ribbon-mode': 'off', | 	'ribbon-mode-image-info': 'off', | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| var BASE_URL = '.' | var BASE_URL = '.' | ||||||
| @ -1030,17 +1031,17 @@ function reloadViewer(images_per_screen){ | |||||||
| 
 | 
 | ||||||
| // Apply the current SETTINGS to current viewer
 | // Apply the current SETTINGS to current viewer
 | ||||||
| function loadSettings(){ | function loadSettings(){ | ||||||
| 	toggleTheme(SETTINGS['theme']) | 	toggleTheme(SETTINGS['global-theme']) | ||||||
| 
 | 
 | ||||||
| 	if(toggleSingleImageMode('?') == 'on'){ | 	if(toggleSingleImageMode('?') == 'on'){ | ||||||
| 		var w = SETTINGS['screen-images-single-image-mode'] | 		var w = SETTINGS['single-image-mode-screen-images'] | ||||||
| 		if(window.PROPORTIONS_RATIO_THRESHOLD == null){ | 		if(window.PROPORTIONS_RATIO_THRESHOLD == null){ | ||||||
| 			var p = SETTINGS['single-image-mode-proportions'] | 			var p = SETTINGS['single-image-mode-proportions'] | ||||||
| 			toggleImageProportions(p) | 			toggleImageProportions(p) | ||||||
| 		} | 		} | ||||||
| 	} else { | 	} else { | ||||||
| 		var w = SETTINGS['screen-images-ribbon-mode'] | 		var w = SETTINGS['ribbon-mode-screen-images'] | ||||||
| 		toggleImageInfo(SETTINGS['image-info-ribbon-mode'] == 'on' ? 'on' : 'off') | 		toggleImageInfo(SETTINGS['ribbon-mode-image-info'] == 'on' ? 'on' : 'off') | ||||||
| 	} | 	} | ||||||
| 	fitNImages(w) | 	fitNImages(w) | ||||||
| } | } | ||||||
|  | |||||||
							
								
								
									
										18
									
								
								ui/modes.js
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								ui/modes.js
									
									
									
									
									
								
							| @ -133,11 +133,11 @@ var toggleSingleImageMode = createCSSClassToggler( | |||||||
| 				TRANSITION_MODE_DEFAULT = 'css' | 				TRANSITION_MODE_DEFAULT = 'css' | ||||||
| 
 | 
 | ||||||
| 				// save things...
 | 				// save things...
 | ||||||
| 				SETTINGS['screen-images-ribbon-mode'] = w | 				SETTINGS['ribbon-mode-screen-images'] = w | ||||||
| 				SETTINGS['image-info-ribbon-mode'] = toggleImageInfo('?') | 				SETTINGS['ribbon-mode-image-info'] = toggleImageInfo('?') | ||||||
| 
 | 
 | ||||||
| 				// load things...
 | 				// load things...
 | ||||||
| 				w = SETTINGS['screen-images-single-image-mode'] | 				w = SETTINGS['single-image-mode-screen-images'] | ||||||
| 				w = w == null ? 1 : w | 				w = w == null ? 1 : w | ||||||
| 				var p = SETTINGS['single-image-mode-proportions'] | 				var p = SETTINGS['single-image-mode-proportions'] | ||||||
| 				p = p == null ? 'square' : p | 				p = p == null ? 'square' : p | ||||||
| @ -152,18 +152,18 @@ var toggleSingleImageMode = createCSSClassToggler( | |||||||
| 				TRANSITION_MODE_DEFAULT = 'animate' | 				TRANSITION_MODE_DEFAULT = 'animate' | ||||||
| 
 | 
 | ||||||
| 				// save things...
 | 				// save things...
 | ||||||
| 				SETTINGS['screen-images-single-image-mode'] = w | 				SETTINGS['single-image-mode-screen-images'] = w | ||||||
| 				SETTINGS['single-image-mode-proportions'] = toggleImageProportions('?') | 				SETTINGS['single-image-mode-proportions'] = toggleImageProportions('?') | ||||||
| 
 | 
 | ||||||
| 				// load things...
 | 				// load things...
 | ||||||
| 				w = SETTINGS['screen-images-ribbon-mode'] | 				w = SETTINGS['ribbon-mode-screen-images'] | ||||||
| 				w = w == null ? DEFAULT_SCREEN_IMAGES : w | 				w = w == null ? DEFAULT_SCREEN_IMAGES : w | ||||||
| 
 | 
 | ||||||
| 				toggleImageProportions('none') | 				toggleImageProportions('none') | ||||||
| 				fitNImages(w) | 				fitNImages(w) | ||||||
| 				var i = SETTINGS['image-info-ribbon-mode'] == 'on' ? 'on' : 'off' | 				var i = SETTINGS['ribbon-mode-image-info'] == 'on' ? 'on' : 'off' | ||||||
| 				toggleImageInfo(i) | 				toggleImageInfo(i) | ||||||
| 				SETTINGS['image-info-ribbon-mode'] = i | 				SETTINGS['ribbon-mode-image-info'] = i | ||||||
| 
 | 
 | ||||||
| 				centerRibbons() | 				centerRibbons() | ||||||
| 			} | 			} | ||||||
| @ -287,7 +287,7 @@ var toggleTheme = createCSSClassToggler( | |||||||
| 		], | 		], | ||||||
| 		// XXX does this get called for default state (gray)???
 | 		// XXX does this get called for default state (gray)???
 | ||||||
| 		function(action){ | 		function(action){ | ||||||
| 			SETTINGS['theme'] = action | 			SETTINGS['global-theme'] = action | ||||||
| 		}) | 		}) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -296,7 +296,7 @@ var toggleImageInfo = createCSSClassToggler( | |||||||
| 		'.image-info-visible', | 		'.image-info-visible', | ||||||
| 		function(action){ | 		function(action){ | ||||||
| 			if(toggleSingleImageMode('?') == 'off'){ | 			if(toggleSingleImageMode('?') == 'off'){ | ||||||
| 				SETTINGS['image-info-ribbon-mode'] = action | 				SETTINGS['ribbon-mode-image-info'] = action | ||||||
| 			} | 			} | ||||||
| 		}) | 		}) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -180,9 +180,9 @@ function setupDataBindings(viewer){ | |||||||
| 
 | 
 | ||||||
| 			// update settings...
 | 			// update settings...
 | ||||||
| 			if(toggleSingleImageMode('?') == 'on'){ | 			if(toggleSingleImageMode('?') == 'on'){ | ||||||
| 				SETTINGS['screen-images-single-image-mode'] = n | 				SETTINGS['single-image-mode-screen-images'] = n | ||||||
| 			} else { | 			} else { | ||||||
| 				SETTINGS['screen-images-ribbon-mode'] = n | 				SETTINGS['ribbon-mode-screen-images'] = n | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			// update proportions...
 | 			// update proportions...
 | ||||||
|  | |||||||
							
								
								
									
										10
									
								
								ui/ui.js
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								ui/ui.js
									
									
									
									
									
								
							| @ -584,6 +584,7 @@ function formDialog(root, message, config, btn, cls){ | |||||||
| 
 | 
 | ||||||
| 				// get the tooltip...
 | 				// get the tooltip...
 | ||||||
| 				if(/[^\\]\|/.test(t)){ | 				if(/[^\\]\|/.test(t)){ | ||||||
|  | 					// XXX do we need to cut the spaces off here???
 | ||||||
| 					var tip = t.split(/\s*\|\s*/) | 					var tip = t.split(/\s*\|\s*/) | ||||||
| 					text = tip[0] | 					text = tip[0] | ||||||
| 					tip = tip[1] | 					tip = tip[1] | ||||||
| @ -660,6 +661,12 @@ function formDialog(root, message, config, btn, cls){ | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /************************************************ Standard dialogs ***/ | /************************************************ Standard dialogs ***/ | ||||||
|  | // NOTE: these return a deferred that will reflect the state of the 
 | ||||||
|  | // 		dialog, and the progress of the operations that it riggers...
 | ||||||
|  | //
 | ||||||
|  | // XXX might be a good idea to be able to block the ui (overlay + progress
 | ||||||
|  | // 		bar?) until some long/critical operations finish, to prevent the
 | ||||||
|  | // 		user from breaking things while the ui is inconsistent...
 | ||||||
| 
 | 
 | ||||||
| var _alert = alert | var _alert = alert | ||||||
| function alert(){ | function alert(){ | ||||||
| @ -742,15 +749,12 @@ function exportPreviewsDialog(state, dfl){ | |||||||
| 				normalizePath(data[keys[2]]),  | 				normalizePath(data[keys[2]]),  | ||||||
| 				data[keys[0]],  | 				data[keys[0]],  | ||||||
| 				data[keys[1]]) | 				data[keys[1]]) | ||||||
| 
 |  | ||||||
| 			// XXX do real reporting...
 | 			// XXX do real reporting...
 | ||||||
| 			showStatusQ('Copying data...') | 			showStatusQ('Copying data...') | ||||||
| 
 |  | ||||||
| 			res.resolve(data['']) | 			res.resolve(data['']) | ||||||
| 		}) | 		}) | ||||||
| 		.fail(function(){  | 		.fail(function(){  | ||||||
| 			showStatusQ('Export: canceled.') | 			showStatusQ('Export: canceled.') | ||||||
| 
 |  | ||||||
| 			res.reject()  | 			res.reject()  | ||||||
| 		}) | 		}) | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user