From 728473bded8af3e3250b5b817f6d2180d2b06bc8 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 25 Nov 2011 22:26:39 +0100 Subject: [PATCH] Add filesize filtering; more descriptive names. --- script.coffee | 49 +++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/script.coffee b/script.coffee index 2c4a33883..67ed32f4f 100644 --- a/script.coffee +++ b/script.coffee @@ -44,13 +44,14 @@ config = 'Quote Preview': [true, 'Show quote content on hover'] 'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes'] filter: - name: '' - trip: '' - mail: '' - sub: '' - com: '' - file: '' - md5: '' + name: '' + tripcode: '' + email: '' + subject: '' + comment: '' + filename: '' + filesize: '' + md5: '' flavors: [ 'http://iqdb.org/?url=' 'http://google.com/searchbyimage?image_url=' @@ -414,20 +415,23 @@ filter = name: (root) -> name = if root.className is 'op' then $ '.postername', root else $ '.commentpostername', root filter.test 'name', name.textContent - trip: (root) -> + tripcode: (root) -> if trip = $ '.postertrip', root - filter.test 'trip', trip.textContent - mail: (root) -> + filter.test 'tripcode', trip.textContent + email: (root) -> if mail = $ '.linkmail', root - filter.test 'mail', mail.href - sub: (root) -> + filter.test 'email', mail.href + subject: (root) -> sub = if root.className is 'op' then $ '.filetitle', root else $ '.replytitle', root - filter.test 'sub', sub.textContent - com: (root) -> - filter.test 'com', ($.el 'a', innerHTML: $('blockquote', root).innerHTML.replace /
/g, '\n').textContent - file: (root) -> + filter.test 'subject', sub.textContent + comment: (root) -> + filter.test 'comment', ($.el 'a', innerHTML: $('blockquote', root).innerHTML.replace /
/g, '\n').textContent + filename: (root) -> if file = $ '.filesize span', root - filter.test 'file', file.title + filter.test 'filename', file.title + filesize: (root) -> + if img = $ 'img[md5]', root + filter.test 'filesize', img.alt md5: (root) -> if img = $ 'img[md5]', root filter.test 'md5', img.getAttribute('md5') @@ -904,11 +908,12 @@ options = Use regular expressions, one per line.
For example, /weeaboo/i will filter posts containing `weeaboo` case-insensitive.

Name:

-

Tripcode:

-

E-mail:

-

Subject:

-

Comment:

-

Filename:

+

Tripcode:

+

E-mail:

+

Subject:

+

Comment:

+

Filename:

+

Filename:

Image MD5: