diff --git a/4chan_x.user.js b/4chan_x.user.js index 7917a4566..4dda8be61 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1783,10 +1783,11 @@ return _results; }, toggle: function(e) { - var el, id, inline, pathname, root, table, threadID; + var el, id, inline, link, pathname, root, table, threadID; e.preventDefault(); id = this.hash.slice(1); root = $.x('ancestor::td[1]', this); + link = this.parentNode.nodeName === 'FONT' ? this.parentNode : this.nextSibling; if (table = $("#i" + id, root)) { $.rm(table); $.removeClass(this, 'inlined'); @@ -1801,7 +1802,7 @@ $.after(this.parentNode, inline); $.hide($.x('ancestor::table[1]', el)); } else { - $.after(this.parentNode, inline); + $.after(link, inline); } } else { inline = $.el('td', { @@ -1809,7 +1810,7 @@ id: "i" + id, innerHTML: "Loading " + id + "..." }); - $.after(this.parentNode, inline); + $.after(link, inline); pathname = this.pathname; threadID = pathname.split('/').pop(); $.cache(pathname, (function() { diff --git a/script.coffee b/script.coffee index 22e2acc63..e82ce452a 100644 --- a/script.coffee +++ b/script.coffee @@ -1419,6 +1419,7 @@ quoteInline = e.preventDefault() id = @hash[1..] root = $.x 'ancestor::td[1]', @ + link = if @parentNode.nodeName is 'FONT' then @parentNode else @nextSibling if table = $ "#i#{id}", root $.rm table $.removeClass @, 'inlined' @@ -1431,13 +1432,13 @@ quoteInline = $.after @parentNode, inline $.hide $.x 'ancestor::table[1]', el else - $.after @parentNode, inline + $.after link, inline else inline = $.el 'td', className: 'reply inline' id: "i#{id}" innerHTML: "Loading #{id}..." - $.after @parentNode, inline + $.after link, inline {pathname} = @ threadID = pathname.split('/').pop() $.cache pathname, (-> quoteInline.parse @, pathname, id, threadID, inline)