From 46c908bdbf3d189ce64a0005f8cf1a09adf6d932 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 5 Mar 2012 05:02:10 +0100 Subject: [PATCH] Fix post.id in Main.preParse for inlined quotes. --- 4chan_x.user.js | 7 +++---- script.coffee | 24 +++++++++++------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 8f87ce0f2..e3d1250fb 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3932,12 +3932,13 @@ } }, preParse: function(node) { - var klass, post; + var klass; klass = node.className; - post = { + return { root: node, el: klass === 'op' ? node : node.firstChild.firstChild.lastChild, "class": klass, + id: $('input', node).name, threadId: g.THREAD_ID || $.x('ancestor::div[contains(@class,"thread")]', node).firstChild.id, isOP: klass === 'op', isInlined: /\binline\b/.test(klass), @@ -3946,8 +3947,6 @@ quotes: $$('.quotelink', node), backlinks: $$('.backlink', node) }; - post.id = post.el.id; - return post; }, node: function(nodes, notify) { var callback, node, _i, _j, _len, _len2, _ref; diff --git a/script.coffee b/script.coffee index 8e475cd96..6cf642641 100644 --- a/script.coffee +++ b/script.coffee @@ -3240,19 +3240,17 @@ Main = preParse: (node) -> klass = node.className - post = - root: node - el: if klass is 'op' then node else node.firstChild.firstChild.lastChild - class: klass - threadId: g.THREAD_ID or $.x('ancestor::div[contains(@class,"thread")]', node).firstChild.id - isOP: klass is 'op' - isInlined: /\binline\b/.test klass - filesize: $ '.filesize', node - img: $ 'img[md5]', node - quotes: $$ '.quotelink', node - backlinks: $$ '.backlink', node - post.id = post.el.id - post + root: node + el: if klass is 'op' then node else node.firstChild.firstChild.lastChild + class: klass + id: $('input', node).name + threadId: g.THREAD_ID or $.x('ancestor::div[contains(@class,"thread")]', node).firstChild.id + isOP: klass is 'op' + isInlined: /\binline\b/.test klass + filesize: $ '.filesize', node + img: $ 'img[md5]', node + quotes: $$ '.quotelink', node + backlinks: $$ '.backlink', node node: (nodes, notify) -> for callback in g.callbacks try