mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-11-01 11:50:07 +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
|
||||
@ -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/...)
|
||||
@ -920,6 +950,12 @@ function setupDataBindings(viewer){
|
||||
})
|
||||
centerView(null, 'css')
|
||||
|
||||
if(toggleSingleImageMode('?') == 'on'){
|
||||
SETTINGS['screen-images-single-image-mode'] = n
|
||||
} else {
|
||||
SETTINGS['screen-images-ribbon-mode'] = n
|
||||
}
|
||||
|
||||
// update previews...
|
||||
// XXX make this update only what needs updating...
|
||||
updateImages()
|
||||
|
||||
@ -487,9 +487,12 @@ $(function(){
|
||||
loadLocalStorageMarks()
|
||||
}
|
||||
|
||||
loadLocalStorageSettings()
|
||||
|
||||
// XXX stub...
|
||||
//centerView(focusImage($('.image').first()), 'css')
|
||||
updateImages()
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
@ -202,6 +202,8 @@ var KEYBOARD_CONFIG = {
|
||||
//saveLocalStorage()
|
||||
saveLocalStorageData()
|
||||
saveLocalStorageMarks()
|
||||
|
||||
saveLocalStorageSettings()
|
||||
})
|
||||
},
|
||||
Z: {
|
||||
|
||||
@ -55,7 +55,10 @@ var toggleTheme = createCSSClassToggler('.viewer',
|
||||
'gray',
|
||||
'dark',
|
||||
'light'
|
||||
])
|
||||
],
|
||||
function(action){
|
||||
SETTINGS['theme'] = action
|
||||
})
|
||||
|
||||
|
||||
// NOTE: this confirmsto the css toggler protocol, but is not implemented
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user