started work on tag-section navigation...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-12-21 00:52:26 +04:00
parent 212e8ccf88
commit 0d3f0882d6
2 changed files with 40 additions and 5 deletions

View File

@ -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

View File

@ -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...