mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
removed .tagged(..) + tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
7426177b05
commit
9e4ba0c86e
@ -3289,7 +3289,7 @@ var DataWithTags2Prototype = {
|
|||||||
return (this.__tags = this.__tags || new tags.Tags()) },
|
return (this.__tags = this.__tags || new tags.Tags()) },
|
||||||
|
|
||||||
hasTag: function(gid, ...tags){
|
hasTag: function(gid, ...tags){
|
||||||
return this.tags.tagged(this.getImage(gid), ...tags) },
|
return this.tags.tags(this.getImage(gid), ...tags) },
|
||||||
getTags: function(gids){
|
getTags: function(gids){
|
||||||
var that = this
|
var that = this
|
||||||
gids = arguments.length > 1 ? [...arguments]
|
gids = arguments.length > 1 ? [...arguments]
|
||||||
@ -3306,8 +3306,26 @@ var DataWithTags2Prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
tag: function(tags, gids){
|
tag: function(tags, gids){
|
||||||
|
var that = this
|
||||||
|
gids = gids == null || gids == 'current' ? this.getImage() : gids
|
||||||
|
gids = gids instanceof Array ? gids : [gids]
|
||||||
|
|
||||||
|
gids
|
||||||
|
.forEach(function(gid){
|
||||||
|
this.tags.tag(tags, gid) })
|
||||||
|
|
||||||
|
return this
|
||||||
},
|
},
|
||||||
untag: function(tags, gids){
|
untag: function(tags, gids){
|
||||||
|
var that = this
|
||||||
|
gids = gids == null || gids == 'current' ? this.getImage() : gids
|
||||||
|
gids = gids instanceof Array ? gids : [gids]
|
||||||
|
|
||||||
|
gids
|
||||||
|
.forEach(function(gid){
|
||||||
|
this.tags.untag(tags, gid) })
|
||||||
|
|
||||||
|
return this
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleTag: function(){},
|
toggleTag: function(){},
|
||||||
|
|||||||
@ -247,6 +247,10 @@ var TagsPrototype = {
|
|||||||
// XXX Q: should this be .normalizeTags(..) ???
|
// XXX Q: should this be .normalizeTags(..) ???
|
||||||
normalize: function(...tags){
|
normalize: function(...tags){
|
||||||
return this.constructor.normalize.call(this, ...tags) },
|
return this.constructor.normalize.call(this, ...tags) },
|
||||||
|
// NOTE: the query parser is generic and thus is implemented in the
|
||||||
|
// constructor...
|
||||||
|
parseQuery: function(query){
|
||||||
|
return this.constructor.parseQuery.call(this, query) },
|
||||||
|
|
||||||
// Match tags...
|
// Match tags...
|
||||||
//
|
//
|
||||||
@ -391,13 +395,13 @@ var TagsPrototype = {
|
|||||||
tags = tags.length == 1 && tags[0] instanceof Array ?
|
tags = tags.length == 1 && tags[0] instanceof Array ?
|
||||||
tags.shift()
|
tags.shift()
|
||||||
: tags
|
: tags
|
||||||
// XXX is this the new version???
|
|
||||||
var u = this.tags(value)
|
var u = this.tags(value)
|
||||||
return tags
|
while(tags.length > 0){
|
||||||
.reduce(function(res, tag){
|
if(this.match(tags.shift(), u).length == 0){
|
||||||
return res === false ?
|
return false
|
||||||
res
|
}
|
||||||
: that.match(tag, u).length > 0 }, true)
|
}
|
||||||
|
return true
|
||||||
|
|
||||||
// get tags of specific value...
|
// get tags of specific value...
|
||||||
} else if(value){
|
} else if(value){
|
||||||
@ -456,26 +460,6 @@ var TagsPrototype = {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
//
|
|
||||||
// Check if value is tagged by tag/tags...
|
|
||||||
// .tagged(value, tag)
|
|
||||||
// .tagged(value, tag, ..)
|
|
||||||
// .tagged(value, [tag, ..])
|
|
||||||
// -> bool
|
|
||||||
//
|
|
||||||
// XXX not sure if this is optimal...
|
|
||||||
tagged: function(value, ...tags){
|
|
||||||
tags = tags.length == 1 && tags[0] instanceof Array ?
|
|
||||||
tags.shift()
|
|
||||||
: tags
|
|
||||||
var u = this.tags(value)
|
|
||||||
while(tags.length > 0){
|
|
||||||
if(this.match(tags.shift(), u).length == 0){
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
// Add/Remove/Modify tags API...
|
// Add/Remove/Modify tags API...
|
||||||
@ -646,10 +630,6 @@ var TagsPrototype = {
|
|||||||
__query_ns_special: {
|
__query_ns_special: {
|
||||||
values: function(...args){ return args },
|
values: function(...args){ return args },
|
||||||
},
|
},
|
||||||
// NOTE: the query parser is generic and thus is implemented in the
|
|
||||||
// constructor...
|
|
||||||
parseQuery: function(query){
|
|
||||||
return this.constructor.parseQuery.call(this, query) },
|
|
||||||
//
|
//
|
||||||
// Execute query...
|
// Execute query...
|
||||||
// .query(query)
|
// .query(query)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user