From 4bad123c328c9a81dfdf56c8146e98a3c37cf9d3 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 24 Nov 2011 00:47:04 +0100 Subject: [PATCH] Do not hide posts when inlining backlinks. --- 4chan_x.user.js | 16 +--------------- script.coffee | 13 ++----------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 1bbbdb7e6..a219b3475 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2343,7 +2343,7 @@ quoteInline.rm(this, id); } else { if ($.x("ancestor::*[@id='" + id + "']", this)) return; - quoteInline.add(this, id); + $.rm = $.x("following::*[@id='i" + id + "']", this); } return this.classList.toggle('inlined'); }, @@ -2354,7 +2354,6 @@ inline = quoteInline.table(id, el.innerHTML); if (q.className === 'backlink') { $.after(q.parentNode, inline); - $.x('ancestor::table', el).hidden = true; return; } return $.after(root, inline); @@ -2372,19 +2371,6 @@ })); } }, - rm: function(q, id) { - var inlined, table, _i, _len, _ref; - table = $.x("following::*[@id='i" + id + "']", q); - _ref = $$('.backlink.inlined:not(.filtered)', table); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - inlined = _ref[_i]; - $.x('ancestor::table', $.id(inlined.hash.slice(1))).hidden = false; - } - if (/\bbacklink\b/.test(q.className) && !/\bfiltered\b/.test(q.className)) { - $.x('ancestor::table', $.id(id)).hidden = false; - } - return $.rm(table); - }, parse: function(req, pathname, id, threadID, inline) { var body, href, html, link, newInline, op, quote, reply, _i, _j, _len, _len2, _ref, _ref2; if (!inline.parentNode) return; diff --git a/script.coffee b/script.coffee index 5557bdf04..4a4eb8429 100644 --- a/script.coffee +++ b/script.coffee @@ -1807,7 +1807,8 @@ quoteInline = quoteInline.rm @, id else return if $.x("ancestor::*[@id='#{id}']", @) - quoteInline.add @, id + # remove the corresponding table or loading td + $.rm = $.x "following::*[@id='i#{id}']", @ @classList.toggle 'inlined' add: (q, id) -> @@ -1816,7 +1817,6 @@ quoteInline = inline = quoteInline.table id, el.innerHTML if q.className is 'backlink' $.after q.parentNode, inline - $.x('ancestor::table', el).hidden = true return $.after root, inline else @@ -1829,15 +1829,6 @@ quoteInline = threadID = pathname.split('/').pop() $.cache pathname, (-> quoteInline.parse @, pathname, id, threadID, inline) - rm: (q, id) -> - #select the corresponding table or loading td - table = $.x "following::*[@id='i#{id}']", q - for inlined in $$ '.backlink.inlined:not(.filtered)', table - $.x('ancestor::table', $.id inlined.hash[1..]).hidden = false - if /\bbacklink\b/.test(q.className) and not /\bfiltered\b/.test q.className - $.x('ancestor::table', $.id id).hidden = false - $.rm table - parse: (req, pathname, id, threadID, inline) -> return unless inline.parentNode