Merge from Appchan X: src/Filtering

excluded: PostHiding.coffee, ThreadHiding.coffee
This commit is contained in:
ccd0 2015-01-31 00:49:28 -08:00
parent 9067559a0d
commit 5b3ed17296
3 changed files with 8 additions and 10 deletions

View File

@ -1,6 +1,6 @@
Anonymize = Anonymize =
init: -> init: ->
return if g.VIEW not in ['index', 'thread', 'archive'] or !Conf['Anonymize'] return unless g.VIEW in ['index', 'thread', 'archive'] and Conf['Anonymize']
return @archive() if g.VIEW is 'archive' return @archive() if g.VIEW is 'archive'
Post.callbacks.push Post.callbacks.push
@ -23,3 +23,4 @@ Anonymize =
$.ready -> $.ready ->
name.textContent = 'Anonymous' for name in $$ '.name' name.textContent = 'Anonymous' for name in $$ '.name'
$.rm trip for trip in $$ '.postertrip' $.rm trip for trip in $$ '.postertrip'
return

View File

@ -1,7 +1,7 @@
Filter = Filter =
filters: {} filters: {}
init: -> init: ->
return if g.VIEW not in ['index', 'thread'] or !Conf['Filter'] return unless g.VIEW in ['index', 'thread'] and Conf['Filter']
unless Conf['Filtered Backlinks'] unless Conf['Filtered Backlinks']
$.addClass doc, 'hide-backlinks' $.addClass doc, 'hide-backlinks'
@ -100,10 +100,8 @@ Filter =
node: -> node: ->
return if @isClone or @isFetchedQuote return if @isClone or @isFetchedQuote
for key of Filter.filters for key of Filter.filters when (value = Filter[key] @) isnt false
value = Filter[key] @
# Continue if there's nothing to filter (no tripcode for example). # Continue if there's nothing to filter (no tripcode for example).
continue if value is false
for filter in Filter.filters[key] when result = filter value, @isReply for filter in Filter.filters[key] when result = filter value, @isReply
# Hide # Hide
@ -171,7 +169,7 @@ Filter =
menu: menu:
init: -> init: ->
return if g.VIEW not in ['index', 'thread'] or !Conf['Menu'] or !Conf['Filter'] return unless g.VIEW in ['index', 'thread'] and Conf['Menu'] and Conf['Filter']
div = $.el 'div', div = $.el 'div',
textContent: 'Filter' textContent: 'Filter'

View File

@ -22,10 +22,9 @@ Recursive =
rm: (recursive, post) -> rm: (recursive, post) ->
return unless obj = Recursive.recursives[post.fullID] return unless obj = Recursive.recursives[post.fullID]
for rec, i in obj.recursives for rec, i in obj.recursives when rec is recursive
if rec is recursive obj.recursives.splice i, 1
obj.recursives.splice i, 1 obj.args.splice i, 1
obj.args.splice i, 1
return return
apply: (recursive, post, args...) -> apply: (recursive, post, args...) ->