From d14206f0e3d67253a54786d17e63e51527a6f58a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 22 Feb 2012 02:55:36 +0100 Subject: [PATCH 01/13] God damn. --- 4chan_x.user.js | 2 +- changelog | 1 + script.coffee | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 1d2e90187..9aa513a0b 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -630,7 +630,7 @@ }, email: function(root) { var mail; - if (!(mail = $('.linkmail', root))) return mail.href; + if (mail = $('.linkmail', root)) return mail.href; return false; }, subject: function(root, isOP) { diff --git a/changelog b/changelog index 48881d608..0b9a5846d 100644 --- a/changelog +++ b/changelog @@ -3,6 +3,7 @@ master 2.27.1 - Mayhem Fix stubs with the new filter. + Fix mail filtering. The MD5 will now check for exact string matching, it will not use regular expressions. 2.27.0 diff --git a/script.coffee b/script.coffee index 4f54227fe..c9a59ba9f 100644 --- a/script.coffee +++ b/script.coffee @@ -544,7 +544,7 @@ filter = return trip.textContent false email: (root) -> - unless mail = $ '.linkmail', root + if mail = $ '.linkmail', root return mail.href false subject: (root, isOP) -> From 7f26ab50ad1bf5601f31909a8646a9bb17ffd1df Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 22 Feb 2012 05:13:16 +0100 Subject: [PATCH 02/13] Fix revealed spoilers + auto-gif thumbnail dimensions. --- 4chan_x.user.js | 10 ++++++++++ script.coffee | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index 9aa513a0b..113469b95 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4005,6 +4005,16 @@ img[md5], img[md5] + img {\ .presto > .fitwidth img[md5] + img {\ width: 100%;\ }\ +/* revealed spoilers do not have height/width,\ + this fixed "expanded" auto-gifs */\ +img[md5] {\ + max-height: 126px;\ + max-width: 126px;\ +}\ +.op > a > img[md5] {\ + max-height: 251px;\ + max-width: 251px;\ +}\ \ #qr, #qp, #updater, #stats, #ihover, #overlay, #navlinks {\ position: fixed;\ diff --git a/script.coffee b/script.coffee index c9a59ba9f..ba597d389 100644 --- a/script.coffee +++ b/script.coffee @@ -3334,6 +3334,16 @@ img[md5], img[md5] + img { .presto > .fitwidth img[md5] + img { width: 100%; } +/* revealed spoilers do not have height/width, + this fixed "expanded" auto-gifs */ +img[md5] { + max-height: 126px; + max-width: 126px; +} +.op > a > img[md5] { + max-height: 251px; + max-width: 251px; +} #qr, #qp, #updater, #stats, #ihover, #overlay, #navlinks { position: fixed; From d3c4ec36712105354e810bd4224ab833547a5d60 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 22 Feb 2012 05:49:06 +0100 Subject: [PATCH 03/13] Global xpaths optimization. This is actually faster. --- 4chan_x.user.js | 4 ++-- script.coffee | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 113469b95..4953abbad 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -392,7 +392,7 @@ }, x: function(path, root) { if (root == null) root = d.body; - return d.evaluate(path, root, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue; + return d.evaluate(path, root, null, 8, null).singleNodeValue; }, replace: function(root, el) { return root.parentNode.replaceChild(el, root); @@ -641,7 +641,7 @@ comment: function(root) { var i, len, node, nodes, text; text = []; - nodes = d.evaluate('.//node()', root.lastChild, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); + nodes = d.evaluate('.//node()', root.lastChild, null, 7, null); i = 0; len = nodes.snapshotLength; while (i < len) { diff --git a/script.coffee b/script.coffee index ba597d389..08c981e07 100644 --- a/script.coffee +++ b/script.coffee @@ -301,7 +301,8 @@ $.extend $, $.add d.head, style style x: (path, root=d.body) -> - d.evaluate(path, root, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null). + # XPathResult.ANY_UNORDERED_NODE_TYPE is 8 + d.evaluate(path, root, null, 8, null). singleNodeValue replace: (root, el) -> root.parentNode.replaceChild el, root @@ -552,7 +553,8 @@ filter = sub.textContent comment: (root) -> text = [] - nodes = d.evaluate './/node()', root.lastChild, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null + # XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE is 7 + nodes = d.evaluate './/node()', root.lastChild, null, 7, null i = 0 len = nodes.snapshotLength while i < len From b843f7832530b5a03c384fb7bfafb7c13223d2b2 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 22 Feb 2012 06:28:55 +0100 Subject: [PATCH 04/13] More comment text reading for filter optimizations. --- 4chan_x.user.js | 11 +++-------- script.coffee | 8 ++------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 4953abbad..04a293c82 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -639,18 +639,13 @@ return sub.textContent; }, comment: function(root) { - var i, len, node, nodes, text; + var data, i, len, nodes, text; text = []; - nodes = d.evaluate('.//node()', root.lastChild, null, 7, null); + nodes = d.evaluate('.//br|.//text()', root.lastChild, null, 7, null); i = 0; len = nodes.snapshotLength; while (i < len) { - node = nodes.snapshotItem(i++); - if (node instanceof Text) { - text.push(node.data); - } else if (node instanceof HTMLBRElement) { - text.push('\n'); - } + text.push((data = nodes.snapshotItem(i++).data) ? data : '\n'); } return text.join(''); }, diff --git a/script.coffee b/script.coffee index 08c981e07..0605e5703 100644 --- a/script.coffee +++ b/script.coffee @@ -554,15 +554,11 @@ filter = comment: (root) -> text = [] # XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE is 7 - nodes = d.evaluate './/node()', root.lastChild, null, 7, null + nodes = d.evaluate './/br|.//text()', root.lastChild, null, 7, null i = 0 len = nodes.snapshotLength while i < len - node = nodes.snapshotItem i++ - if node instanceof Text - text.push node.data - else if node instanceof HTMLBRElement - text.push '\n' + text.push if data = nodes.snapshotItem(i++).data then data else '\n' text.join '' filename: (root) -> if file = $ '.filesize > span', root From 847dc35f527a1afb9d9548137b88ae258ac3bc99 Mon Sep 17 00:00:00 2001 From: No Face Date: Thu, 23 Feb 2012 11:47:37 +0100 Subject: [PATCH 05/13] Update imagelimit for mlp. --- 4chan_x.user.js | 1 + script.coffee | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 04a293c82..96fe9a2cf 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3223,6 +3223,7 @@ threadStats.imgLimit = (function() { switch (g.BOARD) { case 'a': + case 'mlp': case 'v': return 251; case 'vg': diff --git a/script.coffee b/script.coffee index 0605e5703..23d9f3d27 100644 --- a/script.coffee +++ b/script.coffee @@ -2610,7 +2610,7 @@ threadStats = threadStats.posts = threadStats.images = 0 threadStats.imgLimit = switch g.BOARD - when 'a', 'v' + when 'a', 'mlp', 'v' 251 when 'vg' 501 From 8acf4fc8b795ec60dd1ac6ccd1b00754a2b635e8 Mon Sep 17 00:00:00 2001 From: No Face Date: Thu, 23 Feb 2012 12:00:04 +0100 Subject: [PATCH 06/13] Add unique ID to filter. --- 4chan_x.user.js | 7 +++++++ script.coffee | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index 96fe9a2cf..de98d68f6 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -138,6 +138,7 @@ }, filter: { name: ['# Filter any namefags:', '#/^(?!Anonymous$)/'].join('\n'), + uniqueid: ['# Filter a specific ID:', '#/Txhvk1Tl/'].join('\n'), tripcode: ['# Filter any tripfags', '#/^!/'].join('\n'), 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'), @@ -623,6 +624,11 @@ name = isOP ? $('.postername', root) : $('.commentpostername', root); return name.textContent; }, + uniqueid: function(root) { + var uniqueid; + if (uniqueid = $('.posteruid', root)) return uniqueid.textContent; + return false; + }, tripcode: function(root) { var trip; if (trip = $('.postertrip', root)) return trip.textContent; @@ -2152,6 +2158,7 @@
  • Highlighted OPs will have their threads put on top of board pages by default.
    For example: top:yes or top:no.
  • \ \

    Name:

    \ +

    Unique ID:

    \

    Tripcode:

    \

    E-mail:

    \

    Subject:

    \ diff --git a/script.coffee b/script.coffee index 23d9f3d27..4ea65895d 100644 --- a/script.coffee +++ b/script.coffee @@ -58,6 +58,10 @@ config = '# Filter any namefags:' '#/^(?!Anonymous$)/' ].join '\n' + uniqueid: [ + '# Filter a specific ID:' + '#/Txhvk1Tl/' + ].join '\n' tripcode: [ '# Filter any tripfags' '#/^!/' @@ -540,6 +544,10 @@ filter = name: (root, isOP) -> name = if isOP then $ '.postername', root else $ '.commentpostername', root name.textContent + uniqueid: (root) -> + if uniqueid = $ '.posteruid', root + return uniqueid.textContent + false tripcode: (root) -> if trip = $ '.postertrip', root return trip.textContent @@ -1750,6 +1758,7 @@ options =
  • Highlighted OPs will have their threads put on top of board pages by default.
    For example: top:yes or top:no.
  • Name:

    +

    Unique ID:

    Tripcode:

    E-mail:

    Subject:

    From f7f69383bc8b29e2f3428bdd2be109f36b28b425 Mon Sep 17 00:00:00 2001 From: No Face Date: Thu, 23 Feb 2012 19:34:10 +0100 Subject: [PATCH 07/13] Derp. --- 4chan_x.user.js | 7 ------- script.coffee | 9 --------- 2 files changed, 16 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index de98d68f6..96fe9a2cf 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -138,7 +138,6 @@ }, filter: { name: ['# Filter any namefags:', '#/^(?!Anonymous$)/'].join('\n'), - uniqueid: ['# Filter a specific ID:', '#/Txhvk1Tl/'].join('\n'), tripcode: ['# Filter any tripfags', '#/^!/'].join('\n'), 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'), @@ -624,11 +623,6 @@ name = isOP ? $('.postername', root) : $('.commentpostername', root); return name.textContent; }, - uniqueid: function(root) { - var uniqueid; - if (uniqueid = $('.posteruid', root)) return uniqueid.textContent; - return false; - }, tripcode: function(root) { var trip; if (trip = $('.postertrip', root)) return trip.textContent; @@ -2158,7 +2152,6 @@
  • Highlighted OPs will have their threads put on top of board pages by default.
    For example: top:yes or top:no.
  • \ \

    Name:

    \ -

    Unique ID:

    \

    Tripcode:

    \

    E-mail:

    \

    Subject:

    \ diff --git a/script.coffee b/script.coffee index 4ea65895d..23d9f3d27 100644 --- a/script.coffee +++ b/script.coffee @@ -58,10 +58,6 @@ config = '# Filter any namefags:' '#/^(?!Anonymous$)/' ].join '\n' - uniqueid: [ - '# Filter a specific ID:' - '#/Txhvk1Tl/' - ].join '\n' tripcode: [ '# Filter any tripfags' '#/^!/' @@ -544,10 +540,6 @@ filter = name: (root, isOP) -> name = if isOP then $ '.postername', root else $ '.commentpostername', root name.textContent - uniqueid: (root) -> - if uniqueid = $ '.posteruid', root - return uniqueid.textContent - false tripcode: (root) -> if trip = $ '.postertrip', root return trip.textContent @@ -1758,7 +1750,6 @@ options =
  • Highlighted OPs will have their threads put on top of board pages by default.
    For example: top:yes or top:no.
  • Name:

    -

    Unique ID:

    Tripcode:

    E-mail:

    Subject:

    From 0730e2b099340d8a620b529f4e61882631af8c55 Mon Sep 17 00:00:00 2001 From: No Face Date: Thu, 23 Feb 2012 19:43:08 +0100 Subject: [PATCH 08/13] Update the changelog. --- changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog b/changelog index 0b9a5846d..3d16fc0b2 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- noface + Update imagelimit for mlp. 2.27.1 - Mayhem From 8f043ac1bb9c95e7b1a97eee05fea1311726e606 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 23 Feb 2012 20:13:47 +0100 Subject: [PATCH 09/13] Add /vg/ image redirection. --- 4chan_x.user.js | 1 + script.coffee | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 96fe9a2cf..b651da278 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3337,6 +3337,7 @@ case 'm': case 'tg': case 'u': + case 'vg': return "http://archive.foolz.us/" + href[3] + "/full_image/" + href[5]; } }, diff --git a/script.coffee b/script.coffee index 23d9f3d27..a5cdf93a6 100644 --- a/script.coffee +++ b/script.coffee @@ -2724,7 +2724,7 @@ redirect = # Do not use g.BOARD, the image url can originate from a cross-quote. return unless conf['404 Redirect'] switch href[3] - when 'a', 'jp', 'm', 'tg', 'u' + when 'a', 'jp', 'm', 'tg', 'u', 'vg' "http://archive.foolz.us/#{href[3]}/full_image/#{href[5]}" thread: -> return unless conf['404 Redirect'] From d2294049bf92adff1375e414a7e4014ca2567b04 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 23 Feb 2012 20:14:46 +0100 Subject: [PATCH 10/13] /vg/, like /b/, has only 3 replies per thread on board pages. --- 4chan_x.user.js | 1 + script.coffee | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index b651da278..ad1b802d8 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -790,6 +790,7 @@ num = (function() { switch (g.BOARD) { case 'b': + case 'vg': return 3; case 't': return 1; diff --git a/script.coffee b/script.coffee index a5cdf93a6..fd0563d8e 100644 --- a/script.coffee +++ b/script.coffee @@ -661,7 +661,7 @@ expandThread = a.textContent = a.textContent.replace '-', '+' #goddamit moot num = switch g.BOARD - when 'b' then 3 + when 'b', 'vg' then 3 when 't' then 1 else 5 table = $.x "following::br[@clear]/preceding::table[#{num}]", a From f2ce860998faafaa4ec12148e5a4d3f6aa14420e Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 23 Feb 2012 20:16:49 +0100 Subject: [PATCH 11/13] Prevent thumbnail dimension flickering during page load. --- 4chan_x.user.js | 8 ++++---- script.coffee | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index ad1b802d8..5c76fd49a 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4006,13 +4006,13 @@ img[md5], img[md5] + img {\ /* revealed spoilers do not have height/width,\ this fixed "expanded" auto-gifs */\ img[md5] {\ - max-height: 126px;\ - max-width: 126px;\ -}\ -.op > a > img[md5] {\ max-height: 251px;\ max-width: 251px;\ }\ +td > .filesize > img[md5] {\ + max-height: 126px;\ + max-width: 126px;\ +}\ \ #qr, #qp, #updater, #stats, #ihover, #overlay, #navlinks {\ position: fixed;\ diff --git a/script.coffee b/script.coffee index fd0563d8e..7528224c5 100644 --- a/script.coffee +++ b/script.coffee @@ -3335,13 +3335,13 @@ img[md5], img[md5] + img { /* revealed spoilers do not have height/width, this fixed "expanded" auto-gifs */ img[md5] { - max-height: 126px; - max-width: 126px; -} -.op > a > img[md5] { max-height: 251px; max-width: 251px; } +td > .filesize > img[md5] { + max-height: 126px; + max-width: 126px; +} #qr, #qp, #updater, #stats, #ihover, #overlay, #navlinks { position: fixed; From 82f2dec8523bf55f766815a5533e15558f799a6c Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 23 Feb 2012 20:43:42 +0100 Subject: [PATCH 12/13] Use × instead of x as character representing closing action. --- 4chan_x.user.js | 6 +++--- script.coffee | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 5c76fd49a..576367420 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1523,7 +1523,7 @@ className: 'preview', draggable: true, href: 'javascript:;', - innerHTML: 'x' + innerHTML: '×' }); $('input', this.el).checked = this.spoiler; $.on(this.el, 'click', function() { @@ -1717,7 +1717,7 @@ qr.el = ui.dialog('qr', 'top:0;right:0;', '\
    \ Quick Reply \ - x\ + ×\
    \
    \
    \ @@ -2642,7 +2642,7 @@ for (id in _ref) { props = _ref[id]; x = $.el('a', { - textContent: 'X', + textContent: '\u00d7', href: 'javascript:;' }); $.on(x, 'click', watcher.cb.x); diff --git a/script.coffee b/script.coffee index 7528224c5..4f30f7c0a 100644 --- a/script.coffee +++ b/script.coffee @@ -1226,7 +1226,7 @@ qr = className: 'preview' draggable: true href: 'javascript:;' - innerHTML: 'x' + innerHTML: '×' $('input', @el).checked = @spoiler $.on @el, 'click', => @select() $.on $('.remove', @el), 'click', (e) => @@ -1363,7 +1363,7 @@ qr = qr.el = ui.dialog 'qr', 'top:0;right:0;', '
    Quick Reply - x + ×
    @@ -2178,7 +2178,8 @@ watcher = for board of watched for id, props of watched[board] x = $.el 'a', - textContent: 'X' + # \u00d7 is × + textContent: '\u00d7' href: 'javascript:;' $.on x, 'click', watcher.cb.x link = $.el 'a', props From b966065020f3c59713a9d1bd91dc657e65ca553d Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 23 Feb 2012 20:45:53 +0100 Subject: [PATCH 13/13] Version number in the options will now link to the changelog. Close #255. --- 4chan_x.user.js | 3 ++- script.coffee | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 576367420..8199a2ef1 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2114,7 +2114,8 @@ className: 'reply dialog', innerHTML: '
    \
    \ - 4chan X | ' + VERSION + '\ + 4chan X\ + | ' + VERSION + '\ | Issues\
    \
    \ diff --git a/script.coffee b/script.coffee index 4f30f7c0a..38bfccb71 100644 --- a/script.coffee +++ b/script.coffee @@ -1711,7 +1711,8 @@ options = className: 'reply dialog' innerHTML: '
    - 4chan X | ' + VERSION + ' + 4chan X + | ' + VERSION + ' | Issues