minor tweaks...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-05-22 03:10:24 +04:00
parent 04e4e6ccb8
commit 8695b62a02

View File

@ -648,7 +648,8 @@ function saveLocalStorageMarks(attr){
*/ */
function loadFileImages(path, callback){ function loadFileImages(path, callback){
return $.getJSON(path, function(json){ return $.getJSON(path)
.done(function(json){
IMAGES = json IMAGES = json
localStorage[DATA_ATTR + '_IMAGES_FILE'] = path localStorage[DATA_ATTR + '_IMAGES_FILE'] = path
console.log('Loaded IMAGES...') console.log('Loaded IMAGES...')
@ -659,7 +660,8 @@ function loadFileImages(path, callback){
function loadFile(data_path, image_path, callback){ function loadFile(data_path, image_path, callback){
// CEF // CEF
return $.getJSON(data_path, function(json){ return $.getJSON(data_path)
.done(function(json){
// legacy format... // legacy format...
if(json.version == null){ if(json.version == null){
json = convertDataGen1(json) json = convertDataGen1(json)
@ -672,19 +674,22 @@ function loadFile(data_path, image_path, callback){
} else if(json.version == '2.0') { } else if(json.version == '2.0') {
DATA = json DATA = json
if(image_path != null){ if(image_path != null){
loadFileImages(image_path, function(){ loadFileImages(image_path)
.done(function(){
loadData() loadData()
callback != null && callback() callback != null && callback()
}) })
} else if(DATA.image_file != null) { } else if(DATA.image_file != null) {
loadFileImages(DATA.image_file, function(){ loadFileImages(DATA.image_file)
.done(function(){
loadData() loadData()
callback != null && callback() callback != null && callback()
}) })
} }
// unknown format...
} else { } else {
console.error('unknown format.') console.error('unknown format.')
return return