Use [hidden] as this is easier to work with.

This commit is contained in:
Nicolas Stepien 2012-05-01 16:38:55 +02:00
parent fabd887317
commit 145a6ef581
2 changed files with 10 additions and 6 deletions

View File

@ -943,7 +943,7 @@
button = this.parentNode; button = this.parentNode;
id = button.id.slice(2); id = button.id.slice(2);
quotes = $$(".quotelink[href$='#p" + id + "'], .backlink[href='#p" + id + "']"); quotes = $$(".quotelink[href$='#p" + id + "'], .backlink[href='#p" + id + "']");
if (/\bhidden_reply\b/.test(button.className)) { if (button.nextElementSibling.hidden) {
ReplyHiding.show(button); ReplyHiding.show(button);
for (_i = 0, _len = quotes.length; _i < _len; _i++) { for (_i = 0, _len = quotes.length; _i < _len; _i++) {
quote = quotes[_i]; quote = quotes[_i];
@ -961,9 +961,10 @@
return $.set("hiddenReplies/" + g.BOARD + "/", g.hiddenReplies); return $.set("hiddenReplies/" + g.BOARD + "/", g.hiddenReplies);
}, },
hide: function(button) { hide: function(button) {
if (/\bhidden_reply\b/.test(button.className)) { if (button.nextElementSibling.hidden) {
return; return;
} }
button.nextElementSibling.hidden = true;
$.addClass(button, 'hidden_reply'); $.addClass(button, 'hidden_reply');
if (!Conf['Show Stubs']) { if (!Conf['Show Stubs']) {
button.hidden = true; button.hidden = true;
@ -973,6 +974,7 @@
return $.add(button.firstChild, $.tn(" " + ($('.nameBlock', button.nextElementSibling).textContent))); return $.add(button.firstChild, $.tn(" " + ($('.nameBlock', button.nextElementSibling).textContent)));
}, },
show: function(button) { show: function(button) {
button.nextElementSibling.hidden = false;
$.removeClass(button, 'hidden_reply'); $.removeClass(button, 'hidden_reply');
if (!Conf['Show Stubs']) { if (!Conf['Show Stubs']) {
button.hidden = false; button.hidden = false;
@ -4209,7 +4211,7 @@ a[href="javascript:;"] {\
}\ }\
\ \
.hidden_thread ~ *,\ .hidden_thread ~ *,\
.hidden_reply + .reply,\ .reply[hidden],\
#content > [name=tab]:not(:checked) + div,\ #content > [name=tab]:not(:checked) + div,\
#updater:not(:hover) > :not(.move),\ #updater:not(:hover) > :not(.move),\
#qp > input, #qp .inline, .forwarded {\ #qp > input, #qp .inline, .forwarded {\

View File

@ -746,7 +746,7 @@ ReplyHiding =
button = @parentNode button = @parentNode
id = button.id[2..] id = button.id[2..]
quotes = $$ ".quotelink[href$='#p#{id}'], .backlink[href='#p#{id}']" quotes = $$ ".quotelink[href$='#p#{id}'], .backlink[href='#p#{id}']"
if /\bhidden_reply\b/.test button.className if button.nextElementSibling.hidden
ReplyHiding.show button ReplyHiding.show button
for quote in quotes for quote in quotes
$.removeClass quote, 'filtered' $.removeClass quote, 'filtered'
@ -759,7 +759,8 @@ ReplyHiding =
$.set "hiddenReplies/#{g.BOARD}/", g.hiddenReplies $.set "hiddenReplies/#{g.BOARD}/", g.hiddenReplies
hide: (button) -> hide: (button) ->
return if /\bhidden_reply\b/.test button.className # already hidden once by filter return if button.nextElementSibling.hidden # already hidden once by filter
button.nextElementSibling.hidden = true
$.addClass button, 'hidden_reply' $.addClass button, 'hidden_reply'
unless Conf['Show Stubs'] unless Conf['Show Stubs']
@ -770,6 +771,7 @@ ReplyHiding =
$.add button.firstChild, $.tn " #{$('.nameBlock', button.nextElementSibling).textContent}" $.add button.firstChild, $.tn " #{$('.nameBlock', button.nextElementSibling).textContent}"
show: (button) -> show: (button) ->
button.nextElementSibling.hidden = false
$.removeClass button, 'hidden_reply' $.removeClass button, 'hidden_reply'
unless Conf['Show Stubs'] unless Conf['Show Stubs']
@ -3237,7 +3239,7 @@ a[href="javascript:;"] {
} }
.hidden_thread ~ *, .hidden_thread ~ *,
.hidden_reply + .reply, .reply[hidden],
#content > [name=tab]:not(:checked) + div, #content > [name=tab]:not(:checked) + div,
#updater:not(:hover) > :not(.move), #updater:not(:hover) > :not(.move),
#qp > input, #qp .inline, .forwarded { #qp > input, #qp .inline, .forwarded {