This commit is contained in:
Nicolas Stepien 2012-02-10 22:21:38 +01:00
parent 605363c363
commit 4d23ab6b5b
2 changed files with 17 additions and 7 deletions

View File

@ -2844,7 +2844,7 @@
return this.classList.toggle('inlined');
},
add: function(q, id) {
var el, i, inline, pathname, root, threadID;
var el, i, inline, pathname, root, table, threadID;
root = q.parentNode.nodeName === 'FONT' ? q.parentNode : q.nextSibling ? q.nextSibling : q;
if (el = $.id(id)) {
inline = quoteInline.table(id, el.innerHTML);
@ -2855,7 +2855,9 @@
if (/\bbacklink\b/.test(q.className)) {
$.after(q.parentNode, inline);
if (conf['Forward Hiding']) {
$.addClass($.x('ancestor::table', el), 'forwarded');
table = $.x('ancestor::table', el);
$.addClass(table, 'forwarded');
++table.title || (table.title = 1);
}
return;
}
@ -2882,10 +2884,12 @@
_ref = $$('.backlink.inlined', table);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
inlined = _ref[_i];
$.removeClass($.x('ancestor::table', $.id(inlined.hash.slice(1))), 'forwarded');
table = $.x('ancestor::table', $.id(inlined.hash.slice(1)));
if (!--table.title) $.removeClass(table, 'forwarded');
}
if (/\bbacklink\b/.test(q.className)) {
return $.removeClass($.x('ancestor::table', $.id(id)), 'forwarded');
table = $.x('ancestor::table', $.id(id));
if (!--table.title) return $.removeClass(table, 'forwarded');
}
},
parse: function(req, pathname, id, threadID, inline) {

View File

@ -2251,7 +2251,11 @@ quoteInline =
unread.update()
if /\bbacklink\b/.test q.className
$.after q.parentNode, inline
$.addClass $.x('ancestor::table', el), 'forwarded' if conf['Forward Hiding']
if conf['Forward Hiding']
table = $.x 'ancestor::table', el
$.addClass table, 'forwarded'
# Will only unhide if there's no inlined backlinks of it anymore.
++table.title or table.title = 1
return
$.after root, inline
else
@ -2270,9 +2274,11 @@ quoteInline =
$.rm table
return unless conf['Forward Hiding']
for inlined in $$ '.backlink.inlined', table
$.removeClass $.x('ancestor::table', $.id inlined.hash[1..]), 'forwarded'
table = $.x 'ancestor::table', $.id inlined.hash[1..]
$.removeClass table, 'forwarded' unless --table.title
if /\bbacklink\b/.test q.className
$.removeClass $.x('ancestor::table', $.id id), 'forwarded'
table = $.x 'ancestor::table', $.id id
$.removeClass table, 'forwarded' unless --table.title
parse: (req, pathname, id, threadID, inline) ->
return unless inline.parentNode