mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
added updateRibbonsFromFavDirs()...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
96c71629f3
commit
a2537c5b20
31
ui/data.js
31
ui/data.js
@ -91,8 +91,8 @@ function imageDateCmp(a, b, data){
|
|||||||
// NOTE: this expects gids...
|
// NOTE: this expects gids...
|
||||||
function imageNameCmp(a, b, data){
|
function imageNameCmp(a, b, data){
|
||||||
data = data == null ? IMAGES : data
|
data = data == null ? IMAGES : data
|
||||||
a = data[b].path.split('/')[-1]
|
a = data[b].path.split('/').pop()
|
||||||
b = data[a].path.split('/')[-1]
|
b = data[a].path.split('/').pop()
|
||||||
if(a == b){
|
if(a == b){
|
||||||
return 0
|
return 0
|
||||||
} else if(a < b){
|
} else if(a < b){
|
||||||
@ -102,6 +102,13 @@ function imageNameCmp(a, b, data){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function imageOrderCmp(a, b, data){
|
||||||
|
data = data == null ? DATA : data
|
||||||
|
return data.order.indexOf(a) - data.order.indexOf(b)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Check if a is at position i in lst
|
// Check if a is at position i in lst
|
||||||
//
|
//
|
||||||
@ -426,9 +433,15 @@ function dataFromImages(images){
|
|||||||
|
|
||||||
// NOTE: this depends on listDir(...)
|
// NOTE: this depends on listDir(...)
|
||||||
// NOTE: this assumes that images contain ALL the images...
|
// NOTE: this assumes that images contain ALL the images...
|
||||||
function ribbonsFromFavDirs(path, images){
|
function ribbonsFromFavDirs(path, images, cmp){
|
||||||
path = path == null ? BASE_URL : path
|
path = path == null ? BASE_URL : path
|
||||||
images = images == null ? IMAGES : images
|
images = images == null ? IMAGES : images
|
||||||
|
/*cmp = cmp == null ?
|
||||||
|
function(a, b){
|
||||||
|
return imageDateCmp(a, b, images)
|
||||||
|
}
|
||||||
|
: cmp
|
||||||
|
*/
|
||||||
|
|
||||||
// build a reverse name-gid index for fast access...
|
// build a reverse name-gid index for fast access...
|
||||||
var index = {}
|
var index = {}
|
||||||
@ -464,8 +477,10 @@ function ribbonsFromFavDirs(path, images){
|
|||||||
ribbons.push(ribbon)
|
ribbons.push(ribbon)
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove empty ribbons...
|
// remove empty ribbons and sort the rest...
|
||||||
ribbons = $.map(ribbons, function(e){ return e.length > 0 ? [e] : null })
|
ribbons = $.map(ribbons, function(e){
|
||||||
|
return e.length > 0 ? [cmp == null ? e : e.sort(cmp)] : null
|
||||||
|
})
|
||||||
|
|
||||||
return ribbons.reverse()
|
return ribbons.reverse()
|
||||||
}
|
}
|
||||||
@ -1164,6 +1179,12 @@ function loadDir(path, raw_load){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function updateRibbonsFromFavDirs(){
|
||||||
|
DATA.ribbons = ribbonsFromFavDirs(null, null, imageOrderCmp)
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Open image in an external editor/viewer
|
// Open image in an external editor/viewer
|
||||||
//
|
//
|
||||||
// NOTE: this will open the default editor/viewer.
|
// NOTE: this will open the default editor/viewer.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user