From f01ae0a9db6e3a6c793c958ecb0adaa20aa553d2 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 21 Feb 2012 02:30:00 +0100 Subject: [PATCH] Add image dimensions filtering. --- 4chan_x.user.js | 7 +++++++ script.coffee | 22 ++++++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 52edf26ee..714a8cef6 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -141,6 +141,7 @@ subject: '', comment: '', filename: '', + dimensions: '', filesize: '', md5: '' }, @@ -624,6 +625,11 @@ if (file = $('.filesize > span', root)) return file.title; return false; }, + dimensions: function(root) { + var span; + if (span = $('.filesize', root)) return span.textContent.match(/\d+x\d+/)[0]; + return false; + }, filesize: function(root) { var img; if (img = $('img[md5]', root)) return img.alt; @@ -2111,6 +2117,7 @@

Subject:

\

Comment:

\

Filename:

\ +

Image dimensions:

\

Filesize:

\

Image MD5:

\ \ diff --git a/script.coffee b/script.coffee index 71d20df85..42bcd1161 100644 --- a/script.coffee +++ b/script.coffee @@ -52,14 +52,15 @@ config = 'Indicate Cross-thread Quotes': [true, 'Add \'(Cross-thread)\' to cross-threads quotes'] 'Forward Hiding': [true, 'Hide original posts of inlined backlinks'] filter: - name: '' - tripcode: '' - email: '' - subject: '' - comment: '' - filename: '' - filesize: '' - md5: '' + name: '' + tripcode: '' + email: '' + subject: '' + comment: '' + filename: '' + dimensions: '' + filesize: '' + md5: '' sauces: [ 'http://iqdb.org/?url=$1' 'http://www.google.com/searchbyimage?image_url=$1' @@ -506,6 +507,10 @@ filter = if file = $ '.filesize > span', root return file.title false + dimensions: (root) -> + if span = $ '.filesize', root + return span.textContent.match(/\d+x\d+/)[0] + return false filesize: (root) -> if img = $ 'img[md5]', root return img.alt @@ -1683,6 +1688,7 @@ options =

Subject:

Comment:

Filename:

+

Image dimensions:

Filesize:

Image MD5: