From 74dbcd81136a0d496fe0ee8324b8dfbf2c4b708a Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 1 Nov 2013 15:15:01 +0400 Subject: [PATCH] minor tweaking to loadRibbonsFromPath(..) and ribbonsFromFavDirs(..)... Signed-off-by: Alex A. Naanou --- ui/data.js | 9 +++++++-- ui/files.js | 7 ++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ui/data.js b/ui/data.js index 5e676516..9c3334b7 100755 --- a/ui/data.js +++ b/ui/data.js @@ -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 } diff --git a/ui/files.js b/ui/files.js index b2440219..ce984794 100755 --- a/ui/files.js +++ b/ui/files.js @@ -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...