Merge pull request #167 from MayhemYDG/fix

Fix quote inlining in some cases.
This commit is contained in:
James Campos 2011-06-01 13:14:47 -07:00
commit 4977da7d16
2 changed files with 8 additions and 8 deletions

View File

@ -1786,8 +1786,7 @@
var el, id, inline, pathname, root, table, threadID; var el, id, inline, pathname, root, table, threadID;
e.preventDefault(); e.preventDefault();
id = this.hash.slice(1); id = this.hash.slice(1);
root = $.x('ancestor::td[1]', this); if (table = $("#i" + id, $.x('ancestor::td[1]', this))) {
if (table = $("#i" + id, root)) {
$.rm(table); $.rm(table);
$.removeClass(this, 'inlined'); $.removeClass(this, 'inlined');
if (this.className === 'backlink') { if (this.className === 'backlink') {
@ -1795,13 +1794,14 @@
} }
return; return;
} }
root = this.parentNode.nodeName === 'FONT' ? this.parentNode : this.nextSibling;
if (el = d.getElementById(id)) { if (el = d.getElementById(id)) {
inline = quoteInline.table(id, el.innerHTML); inline = quoteInline.table(id, el.innerHTML);
if (this.className === 'backlink') { if (this.className === 'backlink') {
$.after(this.parentNode, inline); $.after(this.parentNode, inline);
$.hide($.x('ancestor::table[1]', el)); $.hide($.x('ancestor::table[1]', el));
} else { } else {
$.after(this.parentNode, inline); $.after(root, inline);
} }
} else { } else {
inline = $.el('td', { inline = $.el('td', {
@ -1809,7 +1809,7 @@
id: "i" + id, id: "i" + id,
innerHTML: "Loading " + id + "..." innerHTML: "Loading " + id + "..."
}); });
$.after(this.parentNode, inline); $.after(root, inline);
pathname = this.pathname; pathname = this.pathname;
threadID = pathname.split('/').pop(); threadID = pathname.split('/').pop();
$.cache(pathname, (function() { $.cache(pathname, (function() {

View File

@ -1418,26 +1418,26 @@ quoteInline =
toggle: (e) -> toggle: (e) ->
e.preventDefault() e.preventDefault()
id = @hash[1..] id = @hash[1..]
root = $.x 'ancestor::td[1]', @ if table = $ "#i#{id}", $.x 'ancestor::td[1]', @
if table = $ "#i#{id}", root
$.rm table $.rm table
$.removeClass @, 'inlined' $.removeClass @, 'inlined'
if @className is 'backlink' if @className is 'backlink'
$.show $.x 'ancestor::table[1]', d.getElementById id $.show $.x 'ancestor::table[1]', d.getElementById id
return return
root = if @parentNode.nodeName is 'FONT' then @parentNode else @nextSibling
if el = d.getElementById id if el = d.getElementById id
inline = quoteInline.table id, el.innerHTML inline = quoteInline.table id, el.innerHTML
if @className is 'backlink' if @className is 'backlink'
$.after @parentNode, inline $.after @parentNode, inline
$.hide $.x 'ancestor::table[1]', el $.hide $.x 'ancestor::table[1]', el
else else
$.after @parentNode, inline $.after root, inline
else else
inline = $.el 'td', inline = $.el 'td',
className: 'reply inline' className: 'reply inline'
id: "i#{id}" id: "i#{id}"
innerHTML: "Loading #{id}..." innerHTML: "Loading #{id}..."
$.after @parentNode, inline $.after root, inline
{pathname} = @ {pathname} = @
threadID = pathname.split('/').pop() threadID = pathname.split('/').pop()
$.cache pathname, (-> quoteInline.parse @, pathname, id, threadID, inline) $.cache pathname, (-> quoteInline.parse @, pathname, id, threadID, inline)