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

View File

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