diff --git a/4chan_x.js b/4chan_x.js index d63381234..d6ac50273 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1432,13 +1432,13 @@ cb: { hide: function(e) { var thread; - thread = e.target.parentNode; + thread = e.target.parentNode.parentNode; return threadHiding.hide(thread); }, show: function(e) { var div, thread; div = e.target.parentNode; - thread = div.nextSibling; + thread = div.parentNode; threadHiding.show(thread); return $.remove(div); } @@ -1446,14 +1446,13 @@ hide: function(thread) { var hiddenThreads, id; threadHiding.hideHide(thread); - id = $('input[value=delete]', thread).name; + id = thread.firstChild.id; hiddenThreads = $.getValue("hiddenThread/" + g.BOARD + "/", {}); hiddenThreads[id] = Date.now(); return $.setValue("hiddenThread/" + g.BOARD + "/", hiddenThreads); }, hideHide: function(thread) { var a, div, name, num, span, text, trip, _ref; - $.hide(thread); if ($.config('Show Stubs')) { if (span = $('.omittedposts', thread)) { num = Number(span.textContent.match(/\d+/)[0]); @@ -1468,18 +1467,23 @@ textContent: "[ + ] " + name + trip + " (" + text + ")" }); $.bind(a, 'click', threadHiding.cb.show); - div = $.el('div'); + div = $.el('div', { + className: 'block' + }); $.append(div, a); - return $.before(thread, div); + $.append(thread, div); + return $.addClass(thread, 'stub'); } else { + $.hide(thread); return $.hide(thread.nextSibling); } }, show: function(thread) { var hiddenThreads, id; + $.removeClass(thread, 'stub'); $.show(thread); $.show(thread.nextSibling); - id = $('input[value=delete]', thread).name; + id = thread.firstChild.id; hiddenThreads = $.getValue("hiddenThread/" + g.BOARD + "/", {}); delete hiddenThreads[id]; return $.setValue("hiddenThread/" + g.BOARD + "/", hiddenThreads); @@ -1972,6 +1976,9 @@ #navlinks > a {\ font-size: 16px;\ }\ + div.thread.stub > *:not(.block) {\ + display: none;\ + }\ .hide {\ display: none;\ }\ diff --git a/script.coffee b/script.coffee index 0ec706edc..5d136b030 100644 --- a/script.coffee +++ b/script.coffee @@ -1094,11 +1094,11 @@ threadHiding = cb: hide: (e) -> - thread = e.target.parentNode + thread = e.target.parentNode.parentNode threadHiding.hide thread show: (e) -> div = e.target.parentNode - thread = div.nextSibling + thread = div.parentNode threadHiding.show thread $.remove div @@ -1106,15 +1106,13 @@ threadHiding = hide: (thread) -> threadHiding.hideHide thread - id = $('input[value=delete]', thread).name + id = thread.firstChild.id hiddenThreads = $.getValue "hiddenThread/#{g.BOARD}/", {} hiddenThreads[id] = Date.now() $.setValue "hiddenThread/#{g.BOARD}/", hiddenThreads hideHide: (thread) -> - $.hide thread - if $.config 'Show Stubs' if span = $ '.omittedposts', thread num = Number span.textContent.match(/\d+/)[0] @@ -1129,18 +1127,22 @@ threadHiding = textContent: "[ + ] #{name}#{trip} (#{text})" $.bind a, 'click', threadHiding.cb.show - div = $.el 'div' + div = $.el 'div', + className: 'block' $.append div, a - $.before thread, div + $.append thread, div + $.addClass thread, 'stub' else + $.hide thread $.hide thread.nextSibling show: (thread) -> + $.removeClass thread, 'stub' $.show thread $.show thread.nextSibling - id = $('input[value=delete]', thread).name + id = thread.firstChild.id hiddenThreads = $.getValue "hiddenThread/#{g.BOARD}/", {} delete hiddenThreads[id] @@ -1587,6 +1589,9 @@ $.addStyle ' #navlinks > a { font-size: 16px; } + div.thread.stub > *:not(.block) { + display: none; + } .hide { display: none; }