diff --git a/4chan_x.js b/4chan_x.js
index 48e6dfe29..8ecd194e1 100644
--- a/4chan_x.js
+++ b/4chan_x.js
@@ -1744,40 +1744,41 @@
}
return;
}
- inline = $.el('table', {
- className: 'inline',
- innerHTML: "
|
"
- });
- td = $('td', inline);
if (el = d.getElementById(id)) {
- td.innerHTML = el.innerHTML;
+ inline = $.el('table', {
+ className: 'inline',
+ innerHTML: "| " + el.innerHTML + " |
"
+ });
+ if (this.className === 'backlink') {
+ $.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);
+ }
} else {
- td.innerHTML = "Loading " + id + "...";
+ inline = $.el('div', {
+ className: 'reply inline',
+ innerHTML: "Loading " + id + "..."
+ });
+ $.after(this.parentNode, inline);
threadID = this.pathname.split('/').pop() || $.x('ancestor::div[@class="thread"]/div', this).id;
if (req = g.requests[threadID]) {
if (req.readyState === 4) {
- quoteInline.parse(req, id, threadID, inline);
+ return quoteInline.parse(req, id, threadID, inline);
}
} else {
- g.requests[threadID] = $.get(this.href, (function() {
+ return g.requests[threadID] = $.get(this.href, (function() {
return quoteInline.parse(this, id, threadID, inline);
}));
}
}
- if (this.className === 'backlink') {
- $.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);
- }
},
parse: function(req, id, threadID, inline) {
- var body, clone, html, op, reply, _i, _len, _ref;
+ var body, html, newInline, op, reply, _i, _len, _ref;
if (req.status !== 200) {
inline.innerHTML = "" + req.status + " " + req.statusText;
return;
}
- clone = inline.cloneNode(true);
body = $.el('body', {
innerHTML: req.responseText
});
@@ -1794,8 +1795,11 @@
}
}
}
- $('td', clone).innerHTML = html;
- return $.replace(inline, clone);
+ newInline = $.el('table', {
+ className: 'inline',
+ innerHTML: "| " + html + " |
"
+ });
+ return $.replace(inline, newInline);
}
};
quotePreview = {
diff --git a/script.coffee b/script.coffee
index 4da2cbb1e..3ae555371 100644
--- a/script.coffee
+++ b/script.coffee
@@ -1393,16 +1393,21 @@ quoteInline =
if @className is 'backlink'
$.show $.x 'ancestor::table[1]', d.getElementById id
return
- inline = $.el 'table',
- className: 'inline'
- innerHTML: " |
"
- td = $ 'td', inline
if el = d.getElementById id
- td.innerHTML = el.innerHTML
+ inline = $.el 'table',
+ className: 'inline'
+ innerHTML: "| #{el.innerHTML} |
"
+ 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
else
- td.innerHTML = "Loading #{id}..."
+ inline = $.el 'div',
+ className: 'reply inline'
+ innerHTML: "Loading #{id}..."
+ $.after @parentNode, inline
# or ... is for index page new posts.
- # FIXME x-thread quotes
threadID = @pathname.split('/').pop() or $.x('ancestor::div[@class="thread"]/div', this).id
if req = g.requests[threadID]
if req.readyState is 4
@@ -1410,17 +1415,11 @@ quoteInline =
else
#FIXME need an array of callbacks
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) ->
if req.status isnt 200
inline.innerHTML = "#{req.status} #{req.statusText}"
return
- clone = inline.cloneNode true
body = $.el 'body',
innerHTML: req.responseText
if id == threadID #OP
@@ -1431,8 +1430,10 @@ quoteInline =
if reply.id == id
html = reply.innerHTML
break
- $('td', clone).innerHTML = html
- $.replace inline, clone
+ newInline = $.el 'table',
+ className: 'inline'
+ innerHTML: "| #{html} |
"
+ $.replace inline, newInline
quotePreview =
init: ->