Fix unread count on inlining, don't inline multiple loading TDs.

This commit is contained in:
Nicolas Stepien 2011-05-18 22:49:02 +02:00
parent 91cb3f12f6
commit 3de7ee04b5
2 changed files with 13 additions and 9 deletions

View File

@ -1731,14 +1731,14 @@
return _results; return _results;
}, },
toggle: function(e) { toggle: function(e) {
var el, id, inline, req, root, td, threadID; var el, id, inline, req, root, table, threadID;
e.preventDefault(); e.preventDefault();
if (!(id = this.hash.slice(1))) { if (!(id = this.hash.slice(1))) {
return; return;
} }
root = $.x('ancestor::td[1]', this); root = $.x('ancestor::td[1]', this);
if (td = $("#i" + id, root)) { if (table = $("#i" + id, root)) {
$.rm($.x('ancestor::table[1]', td)); $.rm(table);
if (this.className === 'backlink') { if (this.className === 'backlink') {
$.show($.x('ancestor::table[1]', d.getElementById(id))); $.show($.x('ancestor::table[1]', d.getElementById(id)));
} }
@ -1755,6 +1755,7 @@
} else { } else {
inline = $.el('td', { inline = $.el('td', {
className: 'reply inline', className: 'reply inline',
id: "i" + id,
innerHTML: "Loading " + id + "..." innerHTML: "Loading " + id + "..."
}); });
$.after(this.parentNode, inline); $.after(this.parentNode, inline);
@ -1799,7 +1800,8 @@
table: function(id, html) { table: function(id, html) {
return $.el('table', { return $.el('table', {
className: 'inline', className: 'inline',
innerHTML: "<tbody><tr><td class=reply id=i" + id + ">" + html + "</td></tr></tbody>" id: "i" + id,
innerHTML: "<tbody><tr><td class=reply>" + html + "</td></tr></tbody>"
}); });
} }
}; };
@ -1919,7 +1921,7 @@
}, },
cb: { cb: {
node: function(root) { node: function(root) {
if (root.className === 'inline') { if (root.className) {
return; return;
} }
unread.replies.push(root); unread.replies.push(root);

View File

@ -1388,8 +1388,8 @@ quoteInline =
e.preventDefault() e.preventDefault()
return unless id = @hash[1..] return unless id = @hash[1..]
root = $.x 'ancestor::td[1]', this root = $.x 'ancestor::td[1]', this
if td = $ "#i#{id}", root if table = $ "#i#{id}", root
$.rm $.x 'ancestor::table[1]', td $.rm table
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
@ -1403,6 +1403,7 @@ quoteInline =
else else
inline = $.el 'td', inline = $.el 'td',
className: 'reply inline' className: 'reply inline'
id: "i#{id}"
innerHTML: "Loading #{id}..." innerHTML: "Loading #{id}..."
$.after @parentNode, inline $.after @parentNode, inline
# or ... is for index page new posts. # or ... is for index page new posts.
@ -1434,7 +1435,8 @@ quoteInline =
table: (id, html) -> table: (id, html) ->
$.el 'table', $.el 'table',
className: 'inline' className: 'inline'
innerHTML: "<tbody><tr><td class=reply id=i#{id}>#{html}</td></tr></tbody>" id: "i#{id}"
innerHTML: "<tbody><tr><td class=reply>#{html}</td></tr></tbody>"
quotePreview = quotePreview =
init: -> init: ->
@ -1515,7 +1517,7 @@ unread =
cb: cb:
node: (root) -> node: (root) ->
return if root.className is 'inline' return if root.className
unread.replies.push root unread.replies.push root
unread.updateTitle() unread.updateTitle()
Favicon.update() Favicon.update()