mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-12-24 20:11:56 +00:00
some refactoring and cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
7d17cace79
commit
5258797173
@ -427,10 +427,12 @@ if(window.CEF_dumpJSON != null){
|
|||||||
getVipsField('exif-ifd0-Artist', source),
|
getVipsField('exif-ifd0-Artist', source),
|
||||||
getVipsField('exif-ifd0-Date and Time', source))
|
getVipsField('exif-ifd0-Date and Time', source))
|
||||||
.done(function(artist, date){
|
.done(function(artist, date){
|
||||||
|
// Artist...
|
||||||
artist = artist
|
artist = artist
|
||||||
.replace(/\([^)]*\)/, '')
|
.replace(/\([^)]*\)/, '')
|
||||||
.trim()
|
.trim()
|
||||||
artist = artist == '' ? 'Unknown' : artist
|
artist = artist == '' ? 'Unknown' : artist
|
||||||
|
// Date...
|
||||||
// format: "20130102-122315"
|
// format: "20130102-122315"
|
||||||
// XXX if not set, get ctime...
|
// XXX if not set, get ctime...
|
||||||
date = date
|
date = date
|
||||||
@ -438,6 +440,7 @@ if(window.CEF_dumpJSON != null){
|
|||||||
.trim()
|
.trim()
|
||||||
.replace(/:/g, '')
|
.replace(/:/g, '')
|
||||||
.replace(/ /g, '-')
|
.replace(/ /g, '-')
|
||||||
|
// File name...
|
||||||
var name = source.split(/[\\\/]/).pop().split('.')[0]
|
var name = source.split(/[\\\/]/).pop().split('.')[0]
|
||||||
|
|
||||||
var text_gid = artist +'-'+ date +'-'+ name
|
var text_gid = artist +'-'+ date +'-'+ name
|
||||||
@ -455,6 +458,10 @@ if(window.CEF_dumpJSON != null){
|
|||||||
getter.resolve(hex_gid)
|
getter.resolve(hex_gid)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// XXX handle arrors in a more informative way...
|
||||||
|
.fail(function(){
|
||||||
|
getter.reject()
|
||||||
|
})
|
||||||
return getter
|
return getter
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,7 +498,6 @@ if(window.CEF_dumpJSON != null){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// PhoneGap
|
// PhoneGap
|
||||||
} else if(false){
|
} else if(false){
|
||||||
|
|
||||||
@ -504,6 +510,8 @@ if(window.CEF_dumpJSON != null){
|
|||||||
window.showDevTools = function(){}
|
window.showDevTools = function(){}
|
||||||
window.reload = function(){}
|
window.reload = function(){}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Bare Chrome...
|
// Bare Chrome...
|
||||||
} else {
|
} else {
|
||||||
console.log('Chrome mode: loading...')
|
console.log('Chrome mode: loading...')
|
||||||
|
|||||||
15
ui/data.js
15
ui/data.js
@ -139,21 +139,6 @@ var DATA_FILE_PATTERN = /^[0-9]*-data.json$/
|
|||||||
|
|
||||||
var IMAGE_PATTERN = /.*\.(jpg|jpeg|png|gif)$/i
|
var IMAGE_PATTERN = /.*\.(jpg|jpeg|png|gif)$/i
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
var UI_IMAGE_CACHE = []
|
|
||||||
$.each([
|
|
||||||
'images/loding.gif',
|
|
||||||
'images/loding-90deg.gif',
|
|
||||||
'images/loding-180deg.gif',
|
|
||||||
'images/loding-270deg.gif'
|
|
||||||
], function(i, e){
|
|
||||||
var img = new Image()
|
|
||||||
img.src = e
|
|
||||||
UI_IMAGE_CACHE.push(img)
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
|
|
||||||
var UPDATE_SORT_ENABLED = false
|
var UPDATE_SORT_ENABLED = false
|
||||||
// XXX for some reason the sync version appears to work faster...
|
// XXX for some reason the sync version appears to work faster...
|
||||||
var UPDATE_SYNC = false
|
var UPDATE_SYNC = false
|
||||||
|
|||||||
22
ui/files.js
22
ui/files.js
@ -683,7 +683,7 @@ function updateImageOrientation(gid, no_update_loaded){
|
|||||||
IMAGES_UPDATED.push(gid)
|
IMAGES_UPDATED.push(gid)
|
||||||
}
|
}
|
||||||
|
|
||||||
// update loaded images...
|
// update image if loaded...
|
||||||
if(!no_update_loaded){
|
if(!no_update_loaded){
|
||||||
var o = getImage(gid)
|
var o = getImage(gid)
|
||||||
if(o.length > 0){
|
if(o.length > 0){
|
||||||
@ -708,26 +708,32 @@ function updateImagesOrientation(gids, no_update_loaded){
|
|||||||
|
|
||||||
// queued version of updateImagesOrientation(...)
|
// queued version of updateImagesOrientation(...)
|
||||||
//
|
//
|
||||||
|
// NOTE: this will ignore errors.
|
||||||
|
//
|
||||||
// XXX need a way to cancel this...
|
// XXX need a way to cancel this...
|
||||||
|
// - one way is to .reject(...) any of the still pending elements,
|
||||||
|
// but there appears no way of getting the list out of when...
|
||||||
function updateImagesOrientationQ(gids, no_update_loaded){
|
function updateImagesOrientationQ(gids, no_update_loaded){
|
||||||
gids = gids == null ? getClosestGIDs() : gids
|
gids = gids == null ? getClosestGIDs() : gids
|
||||||
var res = []
|
//var res = []
|
||||||
|
|
||||||
var last = $.Deferred().resolve()
|
var last = $.Deferred().resolve()
|
||||||
|
|
||||||
$.each(gids, function(_, gid){
|
$.each(gids, function(_, gid){
|
||||||
var cur = $.Deferred()
|
var cur = $.Deferred()
|
||||||
last.done(function(){
|
last.done(function(){
|
||||||
last = updateImageOrientation(gid, no_update_loaded)
|
updateImageOrientation(gid, no_update_loaded)
|
||||||
.done(function(o){
|
.done(function(o){ cur.resolve(o) })
|
||||||
cur.resolve()
|
.fail(function(){ cur.resolve('fail') })
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
res.push(cur)
|
last = cur
|
||||||
|
//res.push(cur)
|
||||||
})
|
})
|
||||||
|
|
||||||
return $.when.apply(null, res)
|
// NOTE: .when(...) is used to add more introspecitve feedback...
|
||||||
|
//return $.when.apply(null, res)
|
||||||
|
return last
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -678,6 +678,24 @@ function assyncCall(func){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
function chainDeferreds(deferred, after){
|
||||||
|
after = after == null ? $.Deferred.resolve() : after
|
||||||
|
|
||||||
|
$.each(deferred, function(_, d){
|
||||||
|
var cur = $.Deferred()
|
||||||
|
after.done(function(){
|
||||||
|
d()
|
||||||
|
.done(function(){ cur.resolve() })
|
||||||
|
.fail(function(){ cur.reject() })
|
||||||
|
})
|
||||||
|
after = cur
|
||||||
|
})
|
||||||
|
|
||||||
|
return after
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user