mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
more work on filenames...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
0d3ea59f40
commit
5b4c7353ef
@ -142,6 +142,26 @@ function(data){
|
||||
}
|
||||
*/
|
||||
|
||||
/* XXX we do not have a ref to images...
|
||||
module.VERSIONS['3.1'] =
|
||||
function(data){
|
||||
res = module.VERSIONS['3.0'](data)
|
||||
|
||||
res.version = '3.1'
|
||||
|
||||
// XXX we do not have a ref to images here...
|
||||
Object.values(res.images || {})
|
||||
.forEach(function(img){
|
||||
Object.keys(img.preview)
|
||||
.forEach(function(res){
|
||||
var p = img.preview[res]
|
||||
img.preview[res] = p.indexOf('%20') >= 0 ? decodeURI(p) : p
|
||||
})
|
||||
})
|
||||
|
||||
return res
|
||||
}
|
||||
//*/
|
||||
|
||||
|
||||
// Get latest updater version...
|
||||
|
||||
@ -351,6 +351,9 @@ module.ImagesClassPrototype = {
|
||||
|
||||
var ImagesPrototype =
|
||||
module.ImagesPrototype = {
|
||||
//version: '3.1',
|
||||
|
||||
|
||||
get length(){
|
||||
return Object.keys(this).length },
|
||||
|
||||
@ -500,6 +503,10 @@ module.ImagesPrototype = {
|
||||
url = previews[k]
|
||||
}
|
||||
}
|
||||
|
||||
// XXX LEGACY...
|
||||
//url = url.indexOf('%20') >= 0 ? decodeURI(url) : url
|
||||
|
||||
return {
|
||||
url: (full_path && img_data.base_path ?
|
||||
img_data.base_path + '/'
|
||||
@ -698,15 +705,31 @@ module.ImagesPrototype = {
|
||||
data = typeof(data) == typeof('str')
|
||||
? JSON.parse(data)
|
||||
: JSON.parse(JSON.stringify(data))
|
||||
var version = data.versio
|
||||
for(var k in data){
|
||||
this[k] = data[k]
|
||||
var img = this[k] = data[k]
|
||||
|
||||
// keep the preview paths decoded...
|
||||
//
|
||||
// NOTE: updating from legacy format...
|
||||
// XXX move this to version conversion... (???)
|
||||
if(version == null){
|
||||
Object.keys(img && img.preview || {})
|
||||
.forEach(function(res){
|
||||
var p = img.preview[res]
|
||||
img.preview[res] = p.indexOf(k+'%20-%20') >= 0 ? decodeURI(p) : p
|
||||
})
|
||||
}
|
||||
}
|
||||
return this
|
||||
},
|
||||
// XXX this is really odd: renaming this to 'toJSON' breaks JavasCript
|
||||
// XXX this is really odd: renaming this to 'toJSON' breaks JavaScript
|
||||
// making chrome/node just say: "<error>" and a filename...
|
||||
dumpJSON: function(data){
|
||||
return JSON.parse(JSON.stringify(this))
|
||||
var res = JSON.parse(JSON.stringify(this))
|
||||
// XXX
|
||||
res.version = '3.0'
|
||||
return res
|
||||
},
|
||||
|
||||
_reset: function(){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user