From 9f329ecd26a4493024ca3d7acfdd09ed1abcb803 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 2 Jul 2012 09:55:25 +0200 Subject: [PATCH] Add Country filtering. --- 4chan_x.user.js | 9 +++++++++ changelog | 2 ++ script.coffee | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index 1c227ee56..6a3332061 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -156,6 +156,7 @@ email: ['# Filter any e-mails that are not `sage` on /a/ and /jp/:', '#/^(?!sage$)/;boards:a,jp'].join('\n'), subject: ['# Filter Generals on /v/:', '#/general/i;boards:v;op:only'].join('\n'), comment: ['# Filter Stallman copypasta on /g/:', '#/what you\'re refer+ing to as linux/i;boards:g'].join('\n'), + country: [''].join('\n'), filename: [''].join('\n'), dimensions: ['# Highlight potential wallpapers:', '#/1920x1080/;op:yes;highlight;top:no;boards:w,wg'].join('\n'), filesize: [''].join('\n'), @@ -706,6 +707,13 @@ } return text.join(''); }, + country: function(post) { + var flag; + if (flag = $('.countryFlag', post.el)) { + return flag.title.replace('Country: ', ''); + } + return false; + }, filename: function(post) { var file, fileInfo; fileInfo = post.fileInfo; @@ -2476,6 +2484,7 @@ \ \ \ + \ \ \ \ diff --git a/changelog b/changelog index 26ea54032..772521b37 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Add Country filtering. 2.33.7 - Mayhem diff --git a/script.coffee b/script.coffee index bbc65d994..c4557a867 100644 --- a/script.coffee +++ b/script.coffee @@ -90,6 +90,9 @@ Config = '# Filter Stallman copypasta on /g/:' '#/what you\'re refer+ing to as linux/i;boards:g' ].join '\n' + country: [ + '' + ].join '\n' filename: [ '' ].join '\n' @@ -556,6 +559,10 @@ Filter = for i in [0...nodes.snapshotLength] text.push if data = nodes.snapshotItem(i).data then data else '\n' text.join '' + country: (post) -> + if flag = $ '.countryFlag', post.el + return flag.title.replace 'Country: ', '' + false filename: (post) -> {fileInfo} = post if fileInfo and file = $ '.fileText > span', fileInfo @@ -1914,6 +1921,7 @@ Options = +