mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 19:00:09 +00:00
updated todo and done some refactoring....
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
73a9c6f2da
commit
eb6640813b
@ -1,6 +1,6 @@
|
|||||||
Priority work
|
Priority work
|
||||||
[_] 61% Preview II
|
[_] 63% Preview II
|
||||||
[_] 20% save state
|
[_] 40% save state
|
||||||
[X] minimal: Local Storage (manual)
|
[X] minimal: Local Storage (manual)
|
||||||
| works across all targets (CEF, PhoneGap, browser)
|
| works across all targets (CEF, PhoneGap, browser)
|
||||||
[_] local JSON (file)
|
[_] local JSON (file)
|
||||||
@ -8,7 +8,7 @@ Priority work
|
|||||||
[_] 0% autosave
|
[_] 0% autosave
|
||||||
[_] on edit
|
[_] on edit
|
||||||
[_] on timer
|
[_] on timer
|
||||||
[_] versions/history
|
[X] versions/history
|
||||||
[_] 33% load state
|
[_] 33% load state
|
||||||
[X] load mechanics
|
[X] load mechanics
|
||||||
[_] auto-load last state on startup
|
[_] auto-load last state on startup
|
||||||
|
|||||||
@ -100,6 +100,17 @@ ImageGrid.GROUP('API',
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
ImageGrid.ACTION({
|
||||||
|
doc: 'Save state to local storage',
|
||||||
|
group: 'API',
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
function save_config(name){
|
||||||
|
if(name == null){
|
||||||
|
name = ''
|
||||||
|
}
|
||||||
|
$.jStorage.set(this.option.KEY_NAME_CONFIG+name, this.sync())
|
||||||
|
}),
|
||||||
ImageGrid.ACTION({
|
ImageGrid.ACTION({
|
||||||
doc: 'Save state to local storage',
|
doc: 'Save state to local storage',
|
||||||
group: 'API',
|
group: 'API',
|
||||||
@ -109,20 +120,20 @@ ImageGrid.GROUP('API',
|
|||||||
if(name == null){
|
if(name == null){
|
||||||
name = ''
|
name = ''
|
||||||
// push the last config to a new version...
|
// push the last config to a new version...
|
||||||
var history = $.jStorage.get(ImageGrid.option.KEY_NAME_HISTORY, [])
|
var history = $.jStorage.get(this.option.KEY_NAME_HISTORY, [])
|
||||||
// XXX should we add a date?
|
// XXX should we add a date?
|
||||||
history.push($.jStorage.get(ImageGrid.option.KEY_NAME_STATE))
|
history.push($.jStorage.get(this.option.KEY_NAME_STATE))
|
||||||
// remove versions beyond ImageGrid.option.VERSIONS_TO_KEEP
|
// remove versions beyond VERSIONS_TO_KEEP...
|
||||||
var c = history.length - ImageGrid.option.VERSIONS_TO_KEEP
|
var c = history.length - this.option.VERSIONS_TO_KEEP
|
||||||
if(c > 0){
|
if(c > 0){
|
||||||
history.splice(0, c)
|
history.splice(0, c)
|
||||||
}
|
}
|
||||||
$.jStorage.set(ImageGrid.option.KEY_NAME_HISTORY, history)
|
$.jStorage.set(this.option.KEY_NAME_HISTORY, history)
|
||||||
} else {
|
} else {
|
||||||
name = '-' + name
|
name = '-' + name
|
||||||
}
|
}
|
||||||
$.jStorage.set(ImageGrid.option.KEY_NAME_CONFIG+name, ImageGrid.sync())
|
this.save_config()
|
||||||
$.jStorage.set(ImageGrid.option.KEY_NAME_STATE+name, buildJSON())
|
$.jStorage.set(this.option.KEY_NAME_STATE+name, buildJSON())
|
||||||
}),
|
}),
|
||||||
ImageGrid.ACTION({
|
ImageGrid.ACTION({
|
||||||
doc: 'Load state from local storage',
|
doc: 'Load state from local storage',
|
||||||
@ -135,11 +146,11 @@ ImageGrid.GROUP('API',
|
|||||||
} else {
|
} else {
|
||||||
name = '-' + name
|
name = '-' + name
|
||||||
}
|
}
|
||||||
loadJSON($.jStorage.get(ImageGrid.option.KEY_NAME_STATE+name, {}))
|
loadJSON($.jStorage.get(this.option.KEY_NAME_STATE+name, {}))
|
||||||
// NOTE: we need to load the config ACTER the state as to be
|
// NOTE: we need to load the config ACTER the state as to be
|
||||||
// able to set correct state-related data like current
|
// able to set correct state-related data like current
|
||||||
// image ID...
|
// image ID...
|
||||||
ImageGrid.set($.jStorage.get(ImageGrid.option.KEY_NAME_CONFIG+name, {}))
|
this.set($.jStorage.get(this.option.KEY_NAME_CONFIG+name, {}))
|
||||||
}),
|
}),
|
||||||
ImageGrid.ACTION({
|
ImageGrid.ACTION({
|
||||||
doc: 'Revert to last verison. if n is given then revert n versions back.\n\n'+
|
doc: 'Revert to last verison. if n is given then revert n versions back.\n\n'+
|
||||||
@ -158,7 +169,7 @@ ImageGrid.GROUP('API',
|
|||||||
n = 1
|
n = 1
|
||||||
}
|
}
|
||||||
var cur = buildJSON()
|
var cur = buildJSON()
|
||||||
var history = $.jStorage.get(ImageGrid.option.KEY_NAME_HISTORY, [])
|
var history = $.jStorage.get(this.option.KEY_NAME_HISTORY, [])
|
||||||
if(history.length <= n){
|
if(history.length <= n){
|
||||||
n = history.length-1
|
n = history.length-1
|
||||||
}
|
}
|
||||||
@ -169,7 +180,7 @@ ImageGrid.GROUP('API',
|
|||||||
history.splice(i, history.length)
|
history.splice(i, history.length)
|
||||||
// push the prev state to enable redo...
|
// push the prev state to enable redo...
|
||||||
history.push(cur)
|
history.push(cur)
|
||||||
$.jStorage.set(ImageGrid.option.KEY_NAME_HISTORY, history)
|
$.jStorage.set(this.option.KEY_NAME_HISTORY, history)
|
||||||
}),
|
}),
|
||||||
|
|
||||||
ImageGrid.ACTION({
|
ImageGrid.ACTION({
|
||||||
@ -181,14 +192,14 @@ ImageGrid.GROUP('API',
|
|||||||
display: false,
|
display: false,
|
||||||
},
|
},
|
||||||
function sync(){
|
function sync(){
|
||||||
for(var n in ImageGrid.option_props){
|
for(var n in this.option_props){
|
||||||
if(this.option_props[n].get != null){
|
if(this.option_props[n].get != null){
|
||||||
var value = this.option_props[n].get()
|
var value = this.option_props[n].get()
|
||||||
this.option_props[n].value = value
|
this.option_props[n].value = value
|
||||||
this.option[n] = value
|
this.option[n] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ImageGrid.option
|
return this.option
|
||||||
}),
|
}),
|
||||||
ImageGrid.ACTION({
|
ImageGrid.ACTION({
|
||||||
doc: 'Get documentation for name.',
|
doc: 'Get documentation for name.',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user