mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-11-04 13:20:10 +00:00 
			
		
		
		
	saving and restoring settings now works...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									6df9184afe
								
							
						
					
					
						commit
						9c3962df81
					
				
							
								
								
									
										36
									
								
								ui/data.js
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								ui/data.js
									
									
									
									
									
								
							@ -577,6 +577,20 @@ function convertDataGen1(data, cmp){
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function loadSettings(){
 | 
				
			||||||
 | 
						toggleTheme(SETTINGS['theme'])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(toggleSingleImageMode('?') == 'on'){
 | 
				
			||||||
 | 
							var w = SETTINGS['screen-images-single-image-mode']
 | 
				
			||||||
 | 
							var p = SETTINGS['single-image-mode-proportions']
 | 
				
			||||||
 | 
							toggleImageProportions(p)
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							var w = SETTINGS['screen-images-ribbon-mode']
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						fitNImages(w)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**********************************************************************
 | 
					/**********************************************************************
 | 
				
			||||||
* localStorage
 | 
					* localStorage
 | 
				
			||||||
@ -653,6 +667,22 @@ function saveLocalStorageMarks(attr){
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function loadLocalStorageSettings(attr){
 | 
				
			||||||
 | 
						attr = attr == null ? DATA_ATTR : attr
 | 
				
			||||||
 | 
						attr += '_SETTINGS'
 | 
				
			||||||
 | 
						SETTINGS = JSON.parse(localStorage[attr])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						loadSettings()
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function saveLocalStorageSettings(attr){
 | 
				
			||||||
 | 
						attr = attr == null ? DATA_ATTR : attr
 | 
				
			||||||
 | 
						attr += '_SETTINGS'
 | 
				
			||||||
 | 
						localStorage[attr] = JSON.stringify(SETTINGS)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**********************************************************************
 | 
					/**********************************************************************
 | 
				
			||||||
* Extension API (CEF/PhoneGap/...)
 | 
					* Extension API (CEF/PhoneGap/...)
 | 
				
			||||||
@ -920,6 +950,12 @@ function setupDataBindings(viewer){
 | 
				
			|||||||
			})
 | 
								})
 | 
				
			||||||
			centerView(null, 'css')
 | 
								centerView(null, 'css')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if(toggleSingleImageMode('?') == 'on'){
 | 
				
			||||||
 | 
									SETTINGS['screen-images-single-image-mode'] = n
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									SETTINGS['screen-images-ribbon-mode'] = n
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// update previews...
 | 
								// update previews...
 | 
				
			||||||
			// XXX make this update only what needs updating...
 | 
								// XXX make this update only what needs updating...
 | 
				
			||||||
			updateImages()
 | 
								updateImages()
 | 
				
			||||||
 | 
				
			|||||||
@ -487,9 +487,12 @@ $(function(){
 | 
				
			|||||||
				loadLocalStorageMarks()
 | 
									loadLocalStorageMarks()
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								loadLocalStorageSettings()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// XXX stub...
 | 
								// XXX stub...
 | 
				
			||||||
			//centerView(focusImage($('.image').first()), 'css')
 | 
								//centerView(focusImage($('.image').first()), 'css')
 | 
				
			||||||
			updateImages()
 | 
								updateImages()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
				
			|||||||
@ -202,6 +202,8 @@ var KEYBOARD_CONFIG = {
 | 
				
			|||||||
						//saveLocalStorage()
 | 
											//saveLocalStorage()
 | 
				
			||||||
						saveLocalStorageData()
 | 
											saveLocalStorageData()
 | 
				
			||||||
						saveLocalStorageMarks()
 | 
											saveLocalStorageMarks()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											saveLocalStorageSettings()
 | 
				
			||||||
					})
 | 
										})
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
		Z: {
 | 
							Z: {
 | 
				
			||||||
 | 
				
			|||||||
@ -55,7 +55,10 @@ var toggleTheme = createCSSClassToggler('.viewer',
 | 
				
			|||||||
			'gray',
 | 
								'gray',
 | 
				
			||||||
			'dark',
 | 
								'dark',
 | 
				
			||||||
			'light'
 | 
								'light'
 | 
				
			||||||
		])
 | 
							],
 | 
				
			||||||
 | 
							function(action){
 | 
				
			||||||
 | 
								SETTINGS['theme'] = action
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NOTE: this confirmsto the css toggler protocol, but is not implemented 
 | 
					// NOTE: this confirmsto the css toggler protocol, but is not implemented 
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user