fix backlink inlining

This commit is contained in:
James Campos 2011-05-27 05:18:33 -07:00
parent 1b9fdd5479
commit fc59170d47
2 changed files with 4 additions and 5 deletions

View File

@ -1778,8 +1778,8 @@
}, },
toggle: function(e) { toggle: function(e) {
var el, id, inline, pathname, root, table, threadID; var el, id, inline, pathname, root, table, threadID;
id = this.hash.slice(1);
e.preventDefault(); e.preventDefault();
id = this.hash.slice(1);
root = $.x('ancestor::td[1]', this); root = $.x('ancestor::td[1]', this);
if (table = $("#i" + id, root)) { if (table = $("#i" + id, root)) {
$.rm(table); $.rm(table);
@ -1792,7 +1792,7 @@
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($('td > br:first-of-type, td > a:last-of-type', 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(this.parentNode, inline);

View File

@ -1417,8 +1417,8 @@ quoteInline =
quote.removeAttribute 'onclick' quote.removeAttribute 'onclick'
$.bind quote, 'click', quoteInline.toggle $.bind quote, 'click', quoteInline.toggle
toggle: (e) -> toggle: (e) ->
id = @hash[1..]
e.preventDefault() e.preventDefault()
id = @hash[1..]
root = $.x 'ancestor::td[1]', @ root = $.x 'ancestor::td[1]', @
if table = $ "#i#{id}", root if table = $ "#i#{id}", root
$.rm table $.rm table
@ -1429,7 +1429,7 @@ quoteInline =
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 $('td > br:first-of-type, td > a:last-of-type', @parentNode), inline $.after @parentNode, inline
$.hide $.x 'ancestor::table[1]', el $.hide $.x 'ancestor::table[1]', el
else else
$.after @parentNode, inline $.after @parentNode, inline
@ -1439,7 +1439,6 @@ quoteInline =
id: "i#{id}" id: "i#{id}"
innerHTML: "Loading #{id}..." innerHTML: "Loading #{id}..."
$.after @parentNode, inline $.after @parentNode, inline
# or ... is for index page new posts.
{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)