mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
some refactoring + bugfix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
98f0e129b5
commit
f1a23fda6d
@ -979,16 +979,6 @@ module.Base = core.ImageGridFeatures.Feature({
|
|||||||
img.forEach(function(_, img){ img.base_path = base_path })
|
img.forEach(function(_, img){ img.base_path = base_path })
|
||||||
}
|
}
|
||||||
|
|
||||||
// extra stuff...
|
|
||||||
// ...this will restore stuff stored in the data but not
|
|
||||||
// explicitly restored above...
|
|
||||||
// XXX do we need this???
|
|
||||||
Object.keys(json.data).forEach(function(k){
|
|
||||||
if(d[k] === undefined){
|
|
||||||
d[k] = json.data[k]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
res.data = d
|
res.data = d
|
||||||
res.images = img
|
res.images = img
|
||||||
}],
|
}],
|
||||||
|
|||||||
@ -2529,7 +2529,7 @@ var DataPrototype = {
|
|||||||
//
|
//
|
||||||
// NOTE: this loads in-place, use .fromJSON(..) to create new data...
|
// NOTE: this loads in-place, use .fromJSON(..) to create new data...
|
||||||
// XXX should this process defaults for unset values???
|
// XXX should this process defaults for unset values???
|
||||||
loadJSON: function(data){
|
loadJSON: function(data, clean){
|
||||||
var that = this
|
var that = this
|
||||||
data = typeof(data) == typeof('str') ? JSON.parse(data) : data
|
data = typeof(data) == typeof('str') ? JSON.parse(data) : data
|
||||||
data = formats.updateData(data)
|
data = formats.updateData(data)
|
||||||
@ -2550,6 +2550,15 @@ var DataPrototype = {
|
|||||||
that[s][k] = that.makeSparseImages(data[s][k])
|
that[s][k] = that.makeSparseImages(data[s][k])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// extra data...
|
||||||
|
!clean
|
||||||
|
&& Object.keys(data).forEach(function(k){
|
||||||
|
if(k != 'version' && that[k] === undefined){
|
||||||
|
that[k] = data[k]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
return this
|
return this
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -2559,7 +2568,7 @@ var DataPrototype = {
|
|||||||
// the result...
|
// the result...
|
||||||
dumpJSON: function(mode){
|
dumpJSON: function(mode){
|
||||||
var res = {
|
var res = {
|
||||||
varsion: module.DATA_VERSION,
|
version: module.DATA_VERSION,
|
||||||
base: this.base,
|
base: this.base,
|
||||||
current: this.current,
|
current: this.current,
|
||||||
order: this.order.slice(),
|
order: this.order.slice(),
|
||||||
|
|||||||
@ -101,6 +101,7 @@ function(data){
|
|||||||
|
|
||||||
// we set the base to the first ribbon...
|
// we set the base to the first ribbon...
|
||||||
res.base = data.base == null ? res.ribbon_order[0] : res.base
|
res.base = data.base == null ? res.ribbon_order[0] : res.base
|
||||||
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +148,7 @@ module.updateData = function(data, clean){
|
|||||||
|
|
||||||
!clean
|
!clean
|
||||||
&& Object.keys(data).forEach(function(k){
|
&& Object.keys(data).forEach(function(k){
|
||||||
if(res[k] == null){
|
if(res[k] === undefined){
|
||||||
res[k] = data[k]
|
res[k] = data[k]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user