more minor tweaks...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-05-22 03:41:51 +04:00
parent 8695b62a02
commit 4e76cbbb60
2 changed files with 33 additions and 32 deletions

View File

@ -656,8 +656,12 @@ function loadFileImages(path, callback){
callback != null && callback()
})
.fail(function(){
console.error('ERROR LOADING:', path)
})
}
function loadFile(data_path, image_path, callback){
// CEF
return $.getJSON(data_path)
@ -695,8 +699,12 @@ function loadFile(data_path, image_path, callback){
return
}
})
.fail(function(){
console.error('ERROR LOADING:', data_path)
})
}
function saveFile(name){
// CEF
if(window.CEF_dumpJSON != null){
@ -716,7 +724,7 @@ function saveFile(name){
function openImage(){
// CEF
if(window.CEF_dumpJSON != null){
if(window.CEF_runSystem != null){
// XXX if path is not present try and open the biggest preview...
return CEF_runSystem(IMAGES[getImageGID()].path)
@ -727,22 +735,20 @@ function openImage(){
}
// XXX need revision...
function loadDir(path){
// CEF
if(window.CEF_loadDir != null){
var dir = CEF_loadDir(path)
IMAGES = dir.images
DATA = dir.data
MARKED = dir.marked
loadData()
// PhoneGap
} else if(false) {
// XXX
}
return loadFile(path +'/data.json')
.fail(function(){
loadFile(path +'/.ImageGrindCache/data.json')
.fail(function(){
// XXX load separate images...
// XXX
})
})
}
/**********************************************************************
* Image caching...
*/

View File

@ -343,19 +343,10 @@ $(function(){
// we have an image file...
if((DATA_ATTR + '_IMAGES_FILE') in localStorage){
loadFileImages(localStorage[DATA_ATTR + '_IMAGES_FILE'])
var loading = loadFileImages(localStorage[DATA_ATTR + '_IMAGES_FILE'])
.done(function(){
DATA = loadLocalStorageData()
loadData()
// XXX this will reload everything...
if('MARKED' in localStorage){
loadLocalStorageMarks()
}
// XXX stub...
//centerView(focusImage($('.image').first()), 'css')
updateImages()
})
} else {
@ -370,17 +361,21 @@ $(function(){
IMAGES = DATA.images
loadData()
}
// XXX this will reload everything...
if('MARKED' in localStorage){
loadLocalStorageMarks()
}
// XXX stub...
//centerView(focusImage($('.image').first()), 'css')
updateImages()
var loading = $.Deferred().resolve()
}
loading
.done(function(){
// XXX this will reload everything...
if('MARKED' in localStorage){
loadLocalStorageMarks()
}
// XXX stub...
//centerView(focusImage($('.image').first()), 'css')
updateImages()
})
})