diff --git a/src/Filtering/Filter.coffee b/src/Filtering/Filter.coffee index a0c6a6193..b41f699e7 100644 --- a/src/Filtering/Filter.coffee +++ b/src/Filtering/Filter.coffee @@ -123,7 +123,7 @@ Filter = 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.value key, post)?) # Continue if there's nothing to filter (no tripcode for example). for filter in Filter.filters[key] continue if ( @@ -165,19 +165,23 @@ Filter = isHidden: (post) -> !!Filter.test(post).hide - postID: (post) -> "#{post.ID}" - name: (post) -> post.info.name - uniqueID: (post) -> post.info.uniqueID or '' - tripcode: (post) -> post.info.tripcode - capcode: (post) -> post.info.capcode - pass: (post) -> post.info.pass - subject: (post) -> post.info.subject or (if post.isReply then undefined else '') - comment: (post) -> (post.info.comment ?= Build.parseComment post.info.commentHTML.innerHTML) - flag: (post) -> post.info.flag - filename: (post) -> post.file?.name - dimensions: (post) -> post.file?.dimensions - filesize: (post) -> post.file?.size - MD5: (post) -> post.file?.MD5 + valueF: + postID: (post) -> "#{post.ID}" + name: (post) -> post.info.name + uniqueID: (post) -> post.info.uniqueID or '' + tripcode: (post) -> post.info.tripcode + capcode: (post) -> post.info.capcode + pass: (post) -> post.info.pass + subject: (post) -> post.info.subject or (if post.isReply then undefined else '') + comment: (post) -> (post.info.comment ?= Build.parseComment post.info.commentHTML.innerHTML) + flag: (post) -> post.info.flag + filename: (post) -> post.file?.name + dimensions: (post) -> post.file?.dimensions + filesize: (post) -> post.file?.size + MD5: (post) -> post.file?.MD5 + + value: (key, post) -> + Filter.valueF[key](post) addFilter: (type, re, cb) -> $.get type, Conf[type], (item) -> @@ -273,14 +277,14 @@ Filter = return { el: el open: (post) -> - value = Filter[type] post + value = Filter.value type, post value? } makeFilter: -> {type} = @dataset # Convert value -> regexp, unless type is MD5 - value = Filter[type] Filter.menu.post + value = Filter.value type, Filter.menu.post re = if type in ['uniqueID', 'MD5'] then value else Filter.escape(value) re = if type in ['uniqueID', 'MD5'] "/#{re}/" diff --git a/src/General/Build.Test.coffee b/src/General/Build.Test.coffee index ec0651b05..24ba74e57 100644 --- a/src/General/Build.Test.coffee +++ b/src/General/Build.Test.coffee @@ -91,8 +91,8 @@ Build.Test = c.log y.outerHTML for key of Config.filter when not key is 'General' and not (key is 'MD5' and post.board.ID is 'f') - val1 = Filter[key] obj - val2 = Filter[key] post2 + val1 = Filter.value key, obj + val2 = Filter.value key, post2 if val1 isnt val2 fail = true c.log "#{post.fullID} has filter bug in #{key}" diff --git a/src/Menu/ArchiveLink.coffee b/src/Menu/ArchiveLink.coffee index e110bb310..c96046e00 100644 --- a/src/Menu/ArchiveLink.coffee +++ b/src/Menu/ArchiveLink.coffee @@ -45,7 +45,7 @@ ArchiveLink = value = if type is 'country' post.info.flagCode or post.info.flagCodeTroll else - Filter[type] post + Filter.value type, post # We want to parse the exact same stuff as the filter does already. return false unless value el.href = Redirect.to 'search',