make thread hiding work again

This commit is contained in:
James Campos 2011-04-10 14:06:40 -07:00
parent f78585381e
commit 96daa0aa3a
2 changed files with 27 additions and 15 deletions

View File

@ -1432,13 +1432,13 @@
cb: { cb: {
hide: function(e) { hide: function(e) {
var thread; var thread;
thread = e.target.parentNode; thread = e.target.parentNode.parentNode;
return threadHiding.hide(thread); return threadHiding.hide(thread);
}, },
show: function(e) { show: function(e) {
var div, thread; var div, thread;
div = e.target.parentNode; div = e.target.parentNode;
thread = div.nextSibling; thread = div.parentNode;
threadHiding.show(thread); threadHiding.show(thread);
return $.remove(div); return $.remove(div);
} }
@ -1446,14 +1446,13 @@
hide: function(thread) { hide: function(thread) {
var hiddenThreads, id; var hiddenThreads, id;
threadHiding.hideHide(thread); threadHiding.hideHide(thread);
id = $('input[value=delete]', thread).name; id = thread.firstChild.id;
hiddenThreads = $.getValue("hiddenThread/" + g.BOARD + "/", {}); hiddenThreads = $.getValue("hiddenThread/" + g.BOARD + "/", {});
hiddenThreads[id] = Date.now(); hiddenThreads[id] = Date.now();
return $.setValue("hiddenThread/" + g.BOARD + "/", hiddenThreads); return $.setValue("hiddenThread/" + g.BOARD + "/", hiddenThreads);
}, },
hideHide: function(thread) { hideHide: function(thread) {
var a, div, name, num, span, text, trip, _ref; var a, div, name, num, span, text, trip, _ref;
$.hide(thread);
if ($.config('Show Stubs')) { if ($.config('Show Stubs')) {
if (span = $('.omittedposts', thread)) { if (span = $('.omittedposts', thread)) {
num = Number(span.textContent.match(/\d+/)[0]); num = Number(span.textContent.match(/\d+/)[0]);
@ -1468,18 +1467,23 @@
textContent: "[ + ] " + name + trip + " (" + text + ")" textContent: "[ + ] " + name + trip + " (" + text + ")"
}); });
$.bind(a, 'click', threadHiding.cb.show); $.bind(a, 'click', threadHiding.cb.show);
div = $.el('div'); div = $.el('div', {
className: 'block'
});
$.append(div, a); $.append(div, a);
return $.before(thread, div); $.append(thread, div);
return $.addClass(thread, 'stub');
} else { } else {
$.hide(thread);
return $.hide(thread.nextSibling); return $.hide(thread.nextSibling);
} }
}, },
show: function(thread) { show: function(thread) {
var hiddenThreads, id; var hiddenThreads, id;
$.removeClass(thread, 'stub');
$.show(thread); $.show(thread);
$.show(thread.nextSibling); $.show(thread.nextSibling);
id = $('input[value=delete]', thread).name; id = thread.firstChild.id;
hiddenThreads = $.getValue("hiddenThread/" + g.BOARD + "/", {}); hiddenThreads = $.getValue("hiddenThread/" + g.BOARD + "/", {});
delete hiddenThreads[id]; delete hiddenThreads[id];
return $.setValue("hiddenThread/" + g.BOARD + "/", hiddenThreads); return $.setValue("hiddenThread/" + g.BOARD + "/", hiddenThreads);
@ -1972,6 +1976,9 @@
#navlinks > a {\ #navlinks > a {\
font-size: 16px;\ font-size: 16px;\
}\ }\
div.thread.stub > *:not(.block) {\
display: none;\
}\
.hide {\ .hide {\
display: none;\ display: none;\
}\ }\

View File

@ -1094,11 +1094,11 @@ threadHiding =
cb: cb:
hide: (e) -> hide: (e) ->
thread = e.target.parentNode thread = e.target.parentNode.parentNode
threadHiding.hide thread threadHiding.hide thread
show: (e) -> show: (e) ->
div = e.target.parentNode div = e.target.parentNode
thread = div.nextSibling thread = div.parentNode
threadHiding.show thread threadHiding.show thread
$.remove div $.remove div
@ -1106,15 +1106,13 @@ threadHiding =
hide: (thread) -> hide: (thread) ->
threadHiding.hideHide thread threadHiding.hideHide thread
id = $('input[value=delete]', thread).name id = thread.firstChild.id
hiddenThreads = $.getValue "hiddenThread/#{g.BOARD}/", {} hiddenThreads = $.getValue "hiddenThread/#{g.BOARD}/", {}
hiddenThreads[id] = Date.now() hiddenThreads[id] = Date.now()
$.setValue "hiddenThread/#{g.BOARD}/", hiddenThreads $.setValue "hiddenThread/#{g.BOARD}/", hiddenThreads
hideHide: (thread) -> hideHide: (thread) ->
$.hide thread
if $.config 'Show Stubs' if $.config 'Show Stubs'
if span = $ '.omittedposts', thread if span = $ '.omittedposts', thread
num = Number span.textContent.match(/\d+/)[0] num = Number span.textContent.match(/\d+/)[0]
@ -1129,18 +1127,22 @@ threadHiding =
textContent: "[ + ] #{name}#{trip} (#{text})" textContent: "[ + ] #{name}#{trip} (#{text})"
$.bind a, 'click', threadHiding.cb.show $.bind a, 'click', threadHiding.cb.show
div = $.el 'div' div = $.el 'div',
className: 'block'
$.append div, a $.append div, a
$.before thread, div $.append thread, div
$.addClass thread, 'stub'
else else
$.hide thread
$.hide thread.nextSibling $.hide thread.nextSibling
show: (thread) -> show: (thread) ->
$.removeClass thread, 'stub'
$.show thread $.show thread
$.show thread.nextSibling $.show thread.nextSibling
id = $('input[value=delete]', thread).name id = thread.firstChild.id
hiddenThreads = $.getValue "hiddenThread/#{g.BOARD}/", {} hiddenThreads = $.getValue "hiddenThread/#{g.BOARD}/", {}
delete hiddenThreads[id] delete hiddenThreads[id]
@ -1587,6 +1589,9 @@ $.addStyle '
#navlinks > a { #navlinks > a {
font-size: 16px; font-size: 16px;
} }
div.thread.stub > *:not(.block) {
display: none;
}
.hide { .hide {
display: none; display: none;
} }