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 =
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'
Post.callbacks.push
@ -23,3 +23,4 @@ Anonymize =
$.ready ->
name.textContent = 'Anonymous' for name in $$ '.name'
$.rm trip for trip in $$ '.postertrip'
return

View File

@ -1,7 +1,7 @@
Filter =
filters: {}
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']
$.addClass doc, 'hide-backlinks'
@ -100,10 +100,8 @@ Filter =
node: ->
return if @isClone or @isFetchedQuote
for key of Filter.filters
value = Filter[key] @
for key of Filter.filters when (value = Filter[key] @) isnt false
# 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
# Hide
@ -171,7 +169,7 @@ Filter =
menu:
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',
textContent: 'Filter'

View File

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