minor tweaking to loadRibbonsFromPath(..) and ribbonsFromFavDirs(..)...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-11-01 15:15:01 +04:00
parent f1f7ceb7e6
commit 74dbcd8113
2 changed files with 11 additions and 5 deletions

View File

@ -1621,18 +1621,23 @@ function appendMarker(){
// NOTE: if cmp is explicitly false then no sorting will be done.
function loadRibbonsFromPath(path, cmp, reverse){
function loadRibbonsFromPath(path, cmp, reverse, dir_name){
path = path == null ? BASE_URL : path
path = normalizePath(path)
cmp = cmp == null ? imageDateCmp : cmp
DATA.ribbons = ribbonsFromFavDirs(path)
// NOTE: we explicitly sort later, this makes no difference
// speed-wise, but will make the code simpler...
DATA.ribbons = ribbonsFromFavDirs(path, null, null, dir_name)
// do the sort...
if(cmp != false){
sortImages(cmp, reverse)
} else {
reloadViewer()
}
return DATA
}

View File

@ -188,9 +188,10 @@ function loadLatestFile(path, dfl, pattern, diff_pattern, default_data){
// NOTE: this depends on listDir(...)
// NOTE: this assumes that images contain ALL the images...
// NOTE: this assumes that all file names are unique...
function ribbonsFromFavDirs(path, images, cmp){
function ribbonsFromFavDirs(path, images, cmp, dir_name){
path = path == null ? getBaseURL() : path
images = images == null ? IMAGES : images
dir_name = dir_name == null ? 'fav' : dir_name
// build a reverse name-gid index for fast access...
var index = {}
@ -208,8 +209,8 @@ function ribbonsFromFavDirs(path, images, cmp){
var files = listDir(path)
var cur_path = path
while(files.indexOf('fav') >= 0){
cur_path += '/fav'
while(files.indexOf(dir_name) >= 0){
cur_path += '/' + dir_name
files = listDir(cur_path)
ribbon = []
// collect the images...