Add option to filter only posts with files.
This commit is contained in:
parent
6dd3150d2b
commit
f823b73a40
@ -59,9 +59,13 @@ Filter =
|
|||||||
], 60
|
], 60
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Filter OPs along with their threads, replies only, or both.
|
# Filter OPs along with their threads or replies only.
|
||||||
# Defaults to both.
|
op = filter.match(/[^t]op:(no|only)/)?[1] or ''
|
||||||
op = filter.match(/[^t]op:(yes|no|only)/)?[1] or 'yes'
|
mask = {'no': 1, 'only': 2}[op] or 0
|
||||||
|
|
||||||
|
# Filter only posts with/without files.
|
||||||
|
file = filter.match(/file:(no|only)/)?[1] or ''
|
||||||
|
mask = mask | ({'no': 4, 'only': 8}[file] or 0)
|
||||||
|
|
||||||
# Overrule the `Show Stubs` setting.
|
# Overrule the `Show Stubs` setting.
|
||||||
# Defaults to stub showing.
|
# Defaults to stub showing.
|
||||||
@ -96,7 +100,7 @@ Filter =
|
|||||||
# Hide the post (default case).
|
# Hide the post (default case).
|
||||||
hide = !(hl or noti)
|
hide = !(hl or noti)
|
||||||
|
|
||||||
filter = {isstring, regexp, boards, excludes, op, hide, stub, hl, top, noti}
|
filter = {isstring, regexp, boards, excludes, mask, hide, stub, hl, top, noti}
|
||||||
if key is 'general'
|
if key is 'general'
|
||||||
for type in types
|
for type in types
|
||||||
(@filters[type] or= []).push filter
|
(@filters[type] or= []).push filter
|
||||||
@ -117,13 +121,15 @@ Filter =
|
|||||||
noti = false
|
noti = false
|
||||||
if QuoteYou.isYou(post)
|
if QuoteYou.isYou(post)
|
||||||
hideable = false
|
hideable = false
|
||||||
|
mask = (if post.isReply then 2 else 1)
|
||||||
|
mask = (mask | (if post.file then 4 else 8))
|
||||||
for key of Filter.filters when ((value = Filter[key] post)?)
|
for key of Filter.filters when ((value = Filter[key] post)?)
|
||||||
# Continue if there's nothing to filter (no tripcode for example).
|
# Continue if there's nothing to filter (no tripcode for example).
|
||||||
for filter in Filter.filters[key]
|
for filter in Filter.filters[key]
|
||||||
continue if (
|
continue if (
|
||||||
(filter.boards and !filter.boards[post.boardID]) or
|
(filter.boards and !filter.boards[post.boardID]) or
|
||||||
(filter.excludes and filter.excludes[post.boardID]) or
|
(filter.excludes and filter.excludes[post.boardID]) or
|
||||||
filter.op is (if post.isReply then 'only' else 'no') or
|
(filter.mask & mask) or
|
||||||
(if filter.isstring then (filter.regexp isnt value) else !filter.regexp.test(value))
|
(if filter.isstring then (filter.regexp isnt value) else !filter.regexp.test(value))
|
||||||
)
|
)
|
||||||
if filter.hide
|
if filter.hide
|
||||||
|
|||||||
@ -15,8 +15,12 @@
|
|||||||
For example: <code>exclude:vg,v;</code>.
|
For example: <code>exclude:vg,v;</code>.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Filter OPs only along with their threads (`only`), replies only (`no`), or both (`yes`, this is default).<br>
|
Filter OPs only along with their threads (`only`) or replies only (`no`).<br>
|
||||||
For example: <code>op:only;</code>, <code>op:no;</code> or <code>op:yes;</code>.
|
For example: <code>op:only;</code> or <code>op:no;</code>.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Filter only posts with files (`only`) or only posts without files (`no`).<br>
|
||||||
|
For example: <code>file:only;</code> or <code>file:no;</code>.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Overrule the `Show Stubs` setting if specified: create a stub (`yes`) or not (`no`).<br>
|
Overrule the `Show Stubs` setting if specified: create a stub (`yes`) or not (`no`).<br>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user