Support filters that apply to multiple post fields joined by newline characters.
This commit is contained in:
parent
e784844333
commit
abb43b3314
@ -92,8 +92,7 @@ Filter =
|
|||||||
# Fields that this filter applies to (for 'general' filters)
|
# Fields that this filter applies to (for 'general' filters)
|
||||||
if key is 'general'
|
if key is 'general'
|
||||||
if (types = filter.match /(?:^|;)\s*type:([^;]*)/)
|
if (types = filter.match /(?:^|;)\s*type:([^;]*)/)
|
||||||
types = types[1].split(',').filter (x) ->
|
types = types[1].split(',')
|
||||||
x of Config.filter and x isnt 'general'
|
|
||||||
else
|
else
|
||||||
types = ['subject', 'name', 'filename', 'comment']
|
types = ['subject', 'name', 'filename', 'comment']
|
||||||
|
|
||||||
@ -181,7 +180,10 @@ Filter =
|
|||||||
MD5: (post) -> post.file?.MD5
|
MD5: (post) -> post.file?.MD5
|
||||||
|
|
||||||
value: (key, post) ->
|
value: (key, post) ->
|
||||||
Filter.valueF[key](post)
|
if key of Filter.valueF
|
||||||
|
Filter.valueF[key](post)
|
||||||
|
else
|
||||||
|
key.split('+').map((k) -> Filter.valueF[k]?(post) or '').join('\n')
|
||||||
|
|
||||||
addFilter: (type, re, cb) ->
|
addFilter: (type, re, cb) ->
|
||||||
$.get type, Conf[type], (item) ->
|
$.get type, Conf[type], (item) ->
|
||||||
|
|||||||
@ -41,7 +41,9 @@
|
|||||||
<li>
|
<li>
|
||||||
Filters in the "General" section apply to multiple fields, by default <code>subject,name,filename,comment</code>.<br>
|
Filters in the "General" section apply to multiple fields, by default <code>subject,name,filename,comment</code>.<br>
|
||||||
The fields can be specified with the <code>type</code> option, separated by commas.<br>
|
The fields can be specified with the <code>type</code> option, separated by commas.<br>
|
||||||
For example: <code>type:@{filterTypes};</code>.
|
For example: <code>type:@{filterTypes};</code>.<br>
|
||||||
|
Types can also be combined with a <code>+</code> sign; this indicates the filter applies to the given fields joined by newlines.<br>
|
||||||
|
For example: <code>type:filename+filesize+dimensions;</code>.<br>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user