diff --git a/ui/data.js b/ui/data.js index 52025f2e..449af7d6 100755 --- a/ui/data.js +++ b/ui/data.js @@ -1216,7 +1216,7 @@ function makeNextFromListAction(get_closest, get_list, restrict_to_ribbon){ var next = get_closest(cur, ribbon) var i = list.indexOf(next)+1 - // we are before the first loaded bookmark, find the first... + // we are before the first loaded elem, find the first... while((next == cur || next == null || getGIDOrder(next) < o) @@ -1226,7 +1226,7 @@ function makeNextFromListAction(get_closest, get_list, restrict_to_ribbon){ i++ } - // did not find any loaded bookmarks after... + // did not find any loaded elems after... if(i >= list.length && (next == null || next == cur diff --git a/ui/tags.js b/ui/tags.js index 3f8b3d60..eb9a5a97 100755 --- a/ui/tags.js +++ b/ui/tags.js @@ -93,8 +93,9 @@ function addTag(tags, gid, tagset, images){ tagset[tag] = set } if(set.indexOf(gid) < 0){ - set.push(gid) - set.sort() + //set.push(gid) + //set.sort() + insertGIDToPosition(gid, set) } if(img_tags.indexOf(tag) < 0){ @@ -183,8 +184,17 @@ function selectByTags(tags, no_sort, tagset){ tags = typeof(tags) == typeof('str') ? [ tags ] : tags tagset = tagset == null ? TAGS : tagset - var subtagset = [] + // special case: a single tag... + if(tags.length == 1){ + var loaded = getLoadedGIDs() + return tagset[tags[0]].filter(function(gid){ + // skip unloaded gids... + return loaded.indexOf(gid) >= 0 + }) + } + var res = [] + var subtagset = [] // populate the subtagset... tags.map(function(tag){ @@ -292,6 +302,31 @@ function unmarkTagged(tags){ } +/*********************************************************************/ + +// XXX this is a bit brain-dead and slow, but should be good for testing... +function _listTagsAtGaps(tags){ + var order = DATA.order + var list = selectByTags(tags) + var res = [] + + list.forEach(function(gid){ + var i = order.indexOf(gid) + + // add the current gid to the result iff one or both gids + // adjacent to it are not in the list... + if(list.indexOf(order[i-1]) < 0 + || list.indexOf(order[i+1]) < 0){ + res.push(gid) + } + }) + + return res +} + + + + /*********************************************************************/ // cropping of tagged images...