mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
added support for leading/trailing '/' in tag matching...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
7327520c0f
commit
158da70086
@ -816,6 +816,15 @@ actions.Actions({
|
|||||||
config: {
|
config: {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// NOTE: resetting this option will clear the last direction...
|
||||||
|
toggleShiftsAffectDirection: ['Interface/Shifts affect direction',
|
||||||
|
core.makeConfigToggler('shifts-affect-direction',
|
||||||
|
['off', 'on'],
|
||||||
|
function(action){
|
||||||
|
action == 'on'
|
||||||
|
&& (delete this.__direction_last) })],
|
||||||
|
|
||||||
|
|
||||||
// basic ribbon editing...
|
// basic ribbon editing...
|
||||||
//
|
//
|
||||||
// NOTE: for all of these, current/ribbon image is a default...
|
// NOTE: for all of these, current/ribbon image is a default...
|
||||||
@ -830,15 +839,6 @@ actions.Actions({
|
|||||||
return this.current_ribbon == this.base && 'disabled' }},
|
return this.current_ribbon == this.base && 'disabled' }},
|
||||||
function(target){ this.data.setBase(target) }],
|
function(target){ this.data.setBase(target) }],
|
||||||
|
|
||||||
// NOTE: resetting this option will clear the last direction...
|
|
||||||
toggleShiftsAffectDirection: ['Interface/Shifts affect direction',
|
|
||||||
core.makeConfigToggler('shifts-affect-direction',
|
|
||||||
['off', 'on'],
|
|
||||||
function(action){
|
|
||||||
action == 'on'
|
|
||||||
&& (delete this.__direction_last) })],
|
|
||||||
|
|
||||||
|
|
||||||
// NOTE: this does not retain direction information, handle individual
|
// NOTE: this does not retain direction information, handle individual
|
||||||
// actions if that info is needed.
|
// actions if that info is needed.
|
||||||
// NOTE: to make things clean, this is triggered in action handlers
|
// NOTE: to make things clean, this is triggered in action handlers
|
||||||
|
|||||||
@ -306,6 +306,8 @@ var TagsPrototype = {
|
|||||||
// Query syntax:
|
// Query syntax:
|
||||||
// a - tag
|
// a - tag
|
||||||
// a/b - path, defines a directional relation between a and b
|
// a/b - path, defines a directional relation between a and b
|
||||||
|
// /a - path special case, matches iff a is at path root
|
||||||
|
// a/ - path special case, matches iff a is at path base
|
||||||
// a:b - set, defines a non-directional relation between a and b
|
// a:b - set, defines a non-directional relation between a and b
|
||||||
// * - tag placeholder, matches one and only one tag name
|
// * - tag placeholder, matches one and only one tag name
|
||||||
//
|
//
|
||||||
@ -371,6 +373,9 @@ var TagsPrototype = {
|
|||||||
|
|
||||||
// match two tags...
|
// match two tags...
|
||||||
} else {
|
} else {
|
||||||
|
var root = /^\s*[\\\/]/.test(a)
|
||||||
|
var base = /[\\\/]\s*$/.test(a)
|
||||||
|
|
||||||
// normalized match...
|
// normalized match...
|
||||||
a = this.normalize(a)
|
a = this.normalize(a)
|
||||||
b = this.normalize(b)
|
b = this.normalize(b)
|
||||||
@ -405,7 +410,13 @@ var TagsPrototype = {
|
|||||||
// tag compatibility deeper in matchSet(..)...
|
// tag compatibility deeper in matchSet(..)...
|
||||||
var sa = a.split(/[\/\\]/g)
|
var sa = a.split(/[\/\\]/g)
|
||||||
var sb = b.split(/[\/\\]/g)
|
var sb = b.split(/[\/\\]/g)
|
||||||
return sb
|
return (
|
||||||
|
// fail if base/root fails...
|
||||||
|
(root && !matchSet(sa[0], sb[0])
|
||||||
|
|| (base && !matchSet(sa[sa.length-1], sb[sb.length-1]))) ?
|
||||||
|
false
|
||||||
|
// normal test...
|
||||||
|
: sb
|
||||||
.reduce(function(a, e){
|
.reduce(function(a, e){
|
||||||
return (a[0]
|
return (a[0]
|
||||||
&& (a[0] == '*'
|
&& (a[0] == '*'
|
||||||
@ -413,7 +424,7 @@ var TagsPrototype = {
|
|||||||
a.slice(1)
|
a.slice(1)
|
||||||
: a
|
: a
|
||||||
}, sa)
|
}, sa)
|
||||||
.length == 0
|
.length == 0)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -448,6 +459,8 @@ var TagsPrototype = {
|
|||||||
match: function(a, b, cmp){
|
match: function(a, b, cmp){
|
||||||
var that = this
|
var that = this
|
||||||
|
|
||||||
|
var edge = /^\s*[\\\/]/.test(a) || /[\\\/]\s*$/.test(a)
|
||||||
|
|
||||||
var res = this.directMatch(...arguments)
|
var res = this.directMatch(...arguments)
|
||||||
|
|
||||||
// get paths with tag...
|
// get paths with tag...
|
||||||
@ -462,7 +475,8 @@ var TagsPrototype = {
|
|||||||
seen = seen || new Set()
|
seen = seen || new Set()
|
||||||
return paths(tag)
|
return paths(tag)
|
||||||
.reduce(function(res, path){
|
.reduce(function(res, path){
|
||||||
if(res == true){
|
if(res == true
|
||||||
|
|| (edge && !that.directMatch(a, path))){
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user