From a638267210591900cfd7625750dc73447308d7ef Mon Sep 17 00:00:00 2001 From: human Date: Thu, 10 Dec 2015 23:28:40 +0200 Subject: [PATCH 1/2] implement exclude rules --- src/Filtering/Filter.coffee | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Filtering/Filter.coffee b/src/Filtering/Filter.coffee index f7ba967a8..39fedfe22 100644 --- a/src/Filtering/Filter.coffee +++ b/src/Filtering/Filter.coffee @@ -22,6 +22,10 @@ Filter = boards = filter.match(/boards:([^;]+)/)?[1].toLowerCase() or 'global' boards = if boards is 'global' then null else boards.split(',') + # boards to exclude from an otherwise global rule + if boards is null + excludes = filter.match(/exclude:([^;]+)/)?[1].toLowerCase().split(',') or null + if key in ['uniqueID', 'MD5'] # MD5 filter will use strings instead of regular expressions. regexp = regexp[1] @@ -64,7 +68,7 @@ Filter = top = filter.match(/top:(yes|no)/)?[1] or 'yes' top = top is 'yes' # Turn it into a boolean - @filters[key].push @createFilter regexp, boards, op, stub, hl, top + @filters[key].push @createFilter regexp, boards, excludes, op, stub, hl, top # Only execute filter types that contain valid filters. unless @filters[key].length @@ -75,7 +79,7 @@ Filter = name: 'Filter' cb: @node - createFilter: (regexp, boards, op, stub, hl, top) -> + createFilter: (regexp, boards, excludes, op, stub, hl, top) -> test = if typeof regexp is 'string' # MD5 checking @@ -92,6 +96,8 @@ Filter = (value, boardID, isReply) -> if boards and boardID not in boards return false + if excludes and boardID in excludes + return false if isReply and op is 'only' or !isReply and op is 'no' return false unless test value From d7395e92a82fe6e070859781de3358f9b700c563 Mon Sep 17 00:00:00 2001 From: human Date: Thu, 10 Dec 2015 23:29:43 +0200 Subject: [PATCH 2/2] add exclude rules to filter guide --- src/General/Settings/Filter-guide.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/General/Settings/Filter-guide.html b/src/General/Settings/Filter-guide.html index 9d453ced6..50ffaf0af 100644 --- a/src/General/Settings/Filter-guide.html +++ b/src/General/Settings/Filter-guide.html @@ -10,6 +10,10 @@ Per boards, separate them with commas. It is global if not specified.
For example: boards:a,jp;. +
  • + In case of a global rule, select boards to be excluded from the filter.
    + For example: exclude:vg,v;. +
  • Filter OPs only along with their threads (`only`), replies only (`no`), or both (`yes`, this is default).
    For example: op:only;, op:no; or op:yes;.