From 8b465172c71067398aca6f68683ed8c8a07606cb Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 17 May 2011 16:00:00 +0200 Subject: [PATCH 1/2] Better placement of inlined backquotes --- 4chan_x.js | 10 ++-------- script.coffee | 9 ++------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index dcf9e0b16..305876b8e 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1738,11 +1738,7 @@ } root = $.x('ancestor::td[1]', this); if (td = $("#i" + id, root)) { - $.rm($.x('ancestor::table[1]', td)); - if (this.className === 'backlink') { - $.show($.x('ancestor::table[1]', d.getElementById(id))); - } - return; + return $.rm(td); } inline = $.el('table', { className: 'inline', @@ -1765,9 +1761,7 @@ } } if (this.className === 'backlink') { - root = $('table, blockquote', root); - $.before(root, inline); - return $.hide($.x('ancestor::table[1]', el)); + return $.after($('td > br:first-of-type, td > a:last-of-type', this.parentNode), inline); } else { return $.after(this.parentNode, inline); } diff --git a/script.coffee b/script.coffee index a78075abd..226ed6027 100644 --- a/script.coffee +++ b/script.coffee @@ -1389,10 +1389,7 @@ quoteInline = return unless id = @hash[1..] root = $.x 'ancestor::td[1]', this if td = $ "#i#{id}", root - $.rm $.x 'ancestor::table[1]', td - if @className is 'backlink' - $.show $.x 'ancestor::table[1]', d.getElementById id - return + return $.rm td inline = $.el 'table', className: 'inline' innerHTML: "" @@ -1411,9 +1408,7 @@ quoteInline = #FIXME need an array of callbacks g.requests[threadID] = $.get @href, (-> quoteInline.parse this, id, threadID, inline) if @className is 'backlink' - root = $ 'table, blockquote', root - $.before root, inline - $.hide $.x 'ancestor::table[1]', el + $.after $('td > br:first-of-type, td > a:last-of-type', @parentNode), inline else $.after @parentNode, inline parse: (req, id, threadID, inline) -> From cc8c0efb4d60866825e42bd86ff239aafbbb958a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 17 May 2011 19:01:39 +0200 Subject: [PATCH 2/2] Rehide? --- 4chan_x.js | 9 +++++++-- script.coffee | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 305876b8e..a1a8841f6 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1738,7 +1738,11 @@ } root = $.x('ancestor::td[1]', this); if (td = $("#i" + id, root)) { - return $.rm(td); + $.rm($.x('ancestor::table[1]', td)); + if (this.className === 'backlink') { + $.show($.x('ancestor::table[1]', d.getElementById(id))); + } + return; } inline = $.el('table', { className: 'inline', @@ -1761,7 +1765,8 @@ } } if (this.className === 'backlink') { - return $.after($('td > br:first-of-type, td > a:last-of-type', this.parentNode), inline); + $.after($('td > br:first-of-type, td > a:last-of-type', this.parentNode), inline); + return $.hide($.x('ancestor::table[1]', el)); } else { return $.after(this.parentNode, inline); } diff --git a/script.coffee b/script.coffee index 226ed6027..3c2f2330f 100644 --- a/script.coffee +++ b/script.coffee @@ -1389,7 +1389,10 @@ quoteInline = return unless id = @hash[1..] root = $.x 'ancestor::td[1]', this if td = $ "#i#{id}", root - return $.rm td + $.rm $.x 'ancestor::table[1]', td + if @className is 'backlink' + $.show $.x 'ancestor::table[1]', d.getElementById id + return inline = $.el 'table', className: 'inline' innerHTML: "" @@ -1409,6 +1412,7 @@ quoteInline = g.requests[threadID] = $.get @href, (-> quoteInline.parse this, id, threadID, inline) if @className is 'backlink' $.after $('td > br:first-of-type, td > a:last-of-type', @parentNode), inline + $.hide $.x 'ancestor::table[1]', el else $.after @parentNode, inline parse: (req, id, threadID, inline) ->