Filter.coffee: cleanup.

This commit is contained in:
ccd0 2015-04-12 14:02:20 -07:00
parent 290c5c7833
commit 3b29b72b15

View File

@ -100,7 +100,7 @@ Filter =
node: -> node: ->
return if @isClone return if @isClone
for key of Filter.filters when (value = Filter[key] @) isnt false for key of Filter.filters when (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).
for filter in Filter.filters[key] when result = filter value, @isReply for filter in Filter.filters[key] when result = filter value, @isReply
@ -121,51 +121,17 @@ Filter =
if !@isReply and result.top if !@isReply and result.top
@thread.isOnTop = true @thread.isOnTop = true
name: (post) -> name: (post) -> post.info.name
if 'name' of post.info uniqueID: (post) -> post.info.uniqueID
return post.info.name tripcode: (post) -> post.info.tripcode
false capcode: (post) -> post.info.capcode
uniqueID: (post) -> subject: (post) -> post.info.subject or undefined
if 'uniqueID' of post.info comment: (post) -> post.info.comment
return post.info.uniqueID flag: (post) -> post.info.flag
false filename: (post) -> post.file?.name
tripcode: (post) -> dimensions: (post) -> post.file?.dimensions
if 'tripcode' of post.info filesize: (post) -> post.file?.size
return post.info.tripcode MD5: (post) -> post.file?.MD5
false
capcode: (post) ->
if 'capcode' of post.info
return post.info.capcode
false
subject: (post) ->
if 'subject' of post.info
return post.info.subject or false
false
comment: (post) ->
if 'comment' of post.info
return post.info.comment
false
flag: (post) ->
if 'flag' of post.info
return post.info.flag
false
filename: (post) ->
if post.file
return post.file.name
false
dimensions: (post) ->
{file} = post
if file?.dimensions
return file.dimensions
false
filesize: (post) ->
if post.file
return post.file.size
false
MD5: (post) ->
if post.file?.MD5
return post.file.MD5
false
menu: menu:
init: -> init: ->
@ -211,7 +177,7 @@ Filter =
el: el el: el
open: (post) -> open: (post) ->
value = Filter[type] post value = Filter[type] post
value isnt false value?
} }
makeFilter: -> makeFilter: ->