mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
minor tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
04e4e6ccb8
commit
8695b62a02
71
ui/data.js
71
ui/data.js
@ -648,48 +648,53 @@ function saveLocalStorageMarks(attr){
|
||||
*/
|
||||
|
||||
function loadFileImages(path, callback){
|
||||
return $.getJSON(path, function(json){
|
||||
IMAGES = json
|
||||
localStorage[DATA_ATTR + '_IMAGES_FILE'] = path
|
||||
console.log('Loaded IMAGES...')
|
||||
return $.getJSON(path)
|
||||
.done(function(json){
|
||||
IMAGES = json
|
||||
localStorage[DATA_ATTR + '_IMAGES_FILE'] = path
|
||||
console.log('Loaded IMAGES...')
|
||||
|
||||
callback != null && callback()
|
||||
})
|
||||
callback != null && callback()
|
||||
})
|
||||
}
|
||||
|
||||
function loadFile(data_path, image_path, callback){
|
||||
// CEF
|
||||
return $.getJSON(data_path, function(json){
|
||||
// legacy format...
|
||||
if(json.version == null){
|
||||
json = convertDataGen1(json)
|
||||
DATA = json.data
|
||||
IMAGES = json.images
|
||||
loadData()
|
||||
return $.getJSON(data_path)
|
||||
.done(function(json){
|
||||
// legacy format...
|
||||
if(json.version == null){
|
||||
json = convertDataGen1(json)
|
||||
DATA = json.data
|
||||
IMAGES = json.images
|
||||
loadData()
|
||||
|
||||
// version 2.0
|
||||
// XXX needs a more flexible protocol...
|
||||
} else if(json.version == '2.0') {
|
||||
DATA = json
|
||||
if(image_path != null){
|
||||
loadFileImages(image_path, function(){
|
||||
loadData()
|
||||
// version 2.0
|
||||
// XXX needs a more flexible protocol...
|
||||
} else if(json.version == '2.0') {
|
||||
DATA = json
|
||||
if(image_path != null){
|
||||
loadFileImages(image_path)
|
||||
.done(function(){
|
||||
loadData()
|
||||
|
||||
callback != null && callback()
|
||||
})
|
||||
} else if(DATA.image_file != null) {
|
||||
loadFileImages(DATA.image_file, function(){
|
||||
loadData()
|
||||
callback != null && callback()
|
||||
})
|
||||
} else if(DATA.image_file != null) {
|
||||
loadFileImages(DATA.image_file)
|
||||
.done(function(){
|
||||
loadData()
|
||||
|
||||
callback != null && callback()
|
||||
})
|
||||
callback != null && callback()
|
||||
})
|
||||
}
|
||||
|
||||
// unknown format...
|
||||
} else {
|
||||
console.error('unknown format.')
|
||||
return
|
||||
}
|
||||
|
||||
} else {
|
||||
console.error('unknown format.')
|
||||
return
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function saveFile(name){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user