From b00bc31097080cb25dcf8e108f81ab9950a04a51 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 15 May 2011 10:23:51 -0700 Subject: [PATCH] less stupidity --- 4chan_x.js | 16 ++++++---------- script.coffee | 15 +++++---------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 8c1214b2c..b901422d1 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1760,17 +1760,13 @@ return $.after(this.parentNode, inline); } }, - parse: function(req, id, threadID, oldInline) { - var body, html, inline, op, reply, td, _i, _len, _ref; + parse: function(req, id, threadID, inline) { + var body, clone, html, op, reply, _i, _len, _ref; if (req.status !== 200) { - oldInline.innerHTML = "" + req.status + " " + req.statusText; + inline.innerHTML = "" + req.status + " " + req.statusText; return; } - inline = $.el('table', { - className: 'inline', - innerHTML: '' - }); - td = $('td', inline); + clone = inline.cloneNode(true); body = $.el('body', { innerHTML: req.responseText }); @@ -1787,8 +1783,8 @@ } } } - td.innerHTML = html; - return $.replace(oldInline, inline); + $('td', clone).innerHTML = html; + return $.replace(inline, clone); } }; quotePreview = { diff --git a/script.coffee b/script.coffee index a71922bb1..bc141d7d3 100644 --- a/script.coffee +++ b/script.coffee @@ -1396,17 +1396,12 @@ quoteInline = $.hide $.x 'ancestor::table[1]', el else $.after @parentNode, inline - parse: (req, id, threadID, oldInline) -> + parse: (req, id, threadID, inline) -> if req.status isnt 200 - oldInline.innerHTML = "#{req.status} #{req.statusText}" + inline.innerHTML = "#{req.status} #{req.statusText}" return - #this is fucking stupid - inline = $.el 'table', - className: 'inline' - innerHTML: '' - td = $ 'td', inline - + clone = inline.cloneNode true body = $.el 'body', innerHTML: req.responseText if id == threadID #OP @@ -1417,8 +1412,8 @@ quoteInline = if reply.id == id html = reply.innerHTML break - td.innerHTML = html - $.replace oldInline, inline + $('td', clone).innerHTML = html + $.replace inline, clone quotePreview = init: ->