Fix thread hiding stubs.

This commit is contained in:
Nicolas Stepien 2013-03-07 19:39:48 +01:00
parent e0600eb02e
commit 12fb19de2c
2 changed files with 9 additions and 7 deletions

View File

@ -2085,14 +2085,15 @@
return ThreadHiding.saveHiddenState(thread);
},
hide: function(thread, makeStub) {
var a, numReplies, opInfo, span, threadRoot;
var OP, a, numReplies, opInfo, span, threadRoot;
if (makeStub == null) {
makeStub = Conf['Stubs'];
}
if (thread.hidden) {
return;
}
threadRoot = thread.OP.nodes.root.parentNode;
OP = thread.OP;
threadRoot = OP.nodes.root.parentNode;
threadRoot.hidden = thread.isHidden = true;
if (!makeStub) {
threadRoot.nextElementSibling.hidden = true;
@ -2104,7 +2105,7 @@
}
numReplies += $$('.opContainer ~ .replyContainer', threadRoot).length;
numReplies = numReplies === 1 ? '1 reply' : "" + numReplies + " replies";
opInfo = Conf['Anonymize'] ? 'Anonymous' : $('.nameBlock', op.nodes.info).textContent;
opInfo = Conf['Anonymize'] ? 'Anonymous' : $('.nameBlock', OP.nodes.info).textContent;
a = ThreadHiding.makeButton(thread, 'show');
$.add(a, $.tn(" " + opInfo + " (" + numReplies + ")"));
thread.stub = $.el('div', {
@ -2112,7 +2113,7 @@
});
$.add(thread.stub, a);
if (Conf['Menu']) {
$.add(thread.stub, [$.tn(' '), Menu.makeButton(op)]);
$.add(thread.stub, [$.tn(' '), Menu.makeButton(OP)]);
}
return $.before(threadRoot, thread.stub);
},

View File

@ -1008,7 +1008,8 @@ ThreadHiding =
hide: (thread, makeStub=Conf['Stubs']) ->
return if thread.hidden
threadRoot = thread.OP.nodes.root.parentNode
{OP} = thread
threadRoot = OP.nodes.root.parentNode
threadRoot.hidden = thread.isHidden = true
unless makeStub
@ -1024,7 +1025,7 @@ ThreadHiding =
if Conf['Anonymize']
'Anonymous'
else
$('.nameBlock', op.nodes.info).textContent
$('.nameBlock', OP.nodes.info).textContent
a = ThreadHiding.makeButton thread, 'show'
$.add a, $.tn " #{opInfo} (#{numReplies})"
@ -1032,7 +1033,7 @@ ThreadHiding =
className: 'stub'
$.add thread.stub, a
if Conf['Menu']
$.add thread.stub, [$.tn(' '), Menu.makeButton op]
$.add thread.stub, [$.tn(' '), Menu.makeButton OP]
$.before threadRoot, thread.stub
show: (thread) ->