From 6bb31cc845815928b7a40df4f4b4e29c38ae3e6d Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Tue, 11 Mar 2014 15:59:02 -0700 Subject: [PATCH] Filtered posts are now added to the PostHiding DataBoard Fixes #632 --- builds/4chan-X.user.js | 38 ++++++++++++++++++++++----------- builds/crx/script.js | 38 ++++++++++++++++++++++----------- src/Filtering/PostHiding.coffee | 6 ++---- src/General/lib/post.class | 4 ++++ 4 files changed, 56 insertions(+), 30 deletions(-) diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 5e239f059..253b789a4 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -1259,6 +1259,11 @@ Recursive.apply('hide', this, label, makeStub, true); Recursive.add('hide', this, label, makeStub, true); } + PostHiding.saveHiddenState(this, { + thisPost: true, + hideRecursively: hideRecursively, + makeStub: makeStub + }); if (!this.isReply) { this.thread.hide(); return; @@ -1300,6 +1305,11 @@ Recursive.apply('show', this, true); Recursive.rm('hide', this); } + PostHiding.saveHiddenState(this, { + thisPost: true, + hideRecursively: showRecursively, + makeStub: !!this.nodes.stub + }); if (!this.isReply) { this.thread.show(); return; @@ -4942,7 +4952,6 @@ } else { post.hide('Manually hidden'); } - PostHiding.saveHiddenState(post); if (post.isReply) { return; } @@ -5119,15 +5128,17 @@ } else { return; } - PostHiding.saveHiddenState(post, { - thisPost: thisPost, - hideRecursively: replies, - makeStub: makeStub - }); + if (!thisPost) { + PostHiding.saveHiddenState(post, { + thisPost: false, + hideRecursively: replies, + makeStub: makeStub + }); + } return $.event('CloseMenu'); }, show: function(post) { - var parent, replies, thisPost, val; + var parent, replies, thisPost; parent = this.parentNode; thisPost = $('input[name=thisPost]', parent).checked; replies = $('input[name=replies]', parent).checked; @@ -5139,12 +5150,13 @@ } else { return; } - val = { - thisPost: !thisPost, - hideRecursively: !replies, - makeStub: !!post.nodes.stub - }; - PostHiding.saveHiddenState(post, val); + if (!thisPost) { + PostHiding.saveHiddenState(post, { + thisPost: false, + hideRecursively: !replies, + makeStub: !!post.nodes.stub + }); + } return $.event('CloseMenu'); } } diff --git a/builds/crx/script.js b/builds/crx/script.js index dced0f0b1..efca1d139 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1314,6 +1314,11 @@ Recursive.apply('hide', this, label, makeStub, true); Recursive.add('hide', this, label, makeStub, true); } + PostHiding.saveHiddenState(this, { + thisPost: true, + hideRecursively: hideRecursively, + makeStub: makeStub + }); if (!this.isReply) { this.thread.hide(); return; @@ -1355,6 +1360,11 @@ Recursive.apply('show', this, true); Recursive.rm('hide', this); } + PostHiding.saveHiddenState(this, { + thisPost: true, + hideRecursively: showRecursively, + makeStub: !!this.nodes.stub + }); if (!this.isReply) { this.thread.show(); return; @@ -4994,7 +5004,6 @@ } else { post.hide('Manually hidden'); } - PostHiding.saveHiddenState(post); if (post.isReply) { return; } @@ -5171,15 +5180,17 @@ } else { return; } - PostHiding.saveHiddenState(post, { - thisPost: thisPost, - hideRecursively: replies, - makeStub: makeStub - }); + if (!thisPost) { + PostHiding.saveHiddenState(post, { + thisPost: false, + hideRecursively: replies, + makeStub: makeStub + }); + } return $.event('CloseMenu'); }, show: function(post) { - var parent, replies, thisPost, val; + var parent, replies, thisPost; parent = this.parentNode; thisPost = $('input[name=thisPost]', parent).checked; replies = $('input[name=replies]', parent).checked; @@ -5191,12 +5202,13 @@ } else { return; } - val = { - thisPost: !thisPost, - hideRecursively: !replies, - makeStub: !!post.nodes.stub - }; - PostHiding.saveHiddenState(post, val); + if (!thisPost) { + PostHiding.saveHiddenState(post, { + thisPost: false, + hideRecursively: !replies, + makeStub: !!post.nodes.stub + }); + } return $.event('CloseMenu'); } } diff --git a/src/Filtering/PostHiding.coffee b/src/Filtering/PostHiding.coffee index 219761d3f..db358cf98 100755 --- a/src/Filtering/PostHiding.coffee +++ b/src/Filtering/PostHiding.coffee @@ -56,7 +56,6 @@ PostHiding = post.show() else post.hide 'Manually hidden' - PostHiding.saveHiddenState post return if post.isReply Index.updateHideLabel() @@ -171,7 +170,7 @@ PostHiding = Recursive.add 'hide', post, label, makeStub, true else return - PostHiding.saveHiddenState post, {thisPost, hideRecursively: replies, makeStub} + PostHiding.saveHiddenState post, {thisPost: false, hideRecursively: replies, makeStub} unless thisPost $.event 'CloseMenu' show: (post) -> parent = @parentNode @@ -184,6 +183,5 @@ PostHiding = Recursive.rm 'hide', post, true else return - val = {thisPost: !thisPost, hideRecursively: !replies, makeStub: !!post.nodes.stub} - PostHiding.saveHiddenState post, val + PostHiding.saveHiddenState post, {thisPost: false, hideRecursively: !replies, makeStub: !!post.nodes.stub} unless thisPost $.event 'CloseMenu' diff --git a/src/General/lib/post.class b/src/General/lib/post.class index 7f4c778e4..2ba2755e2 100755 --- a/src/General/lib/post.class +++ b/src/General/lib/post.class @@ -179,6 +179,8 @@ class Post Recursive.apply 'hide', @, label, makeStub, true Recursive.add 'hide', @, label, makeStub, true + PostHiding.saveHiddenState @, {thisPost: true, hideRecursively: hideRecursively, makeStub: makeStub} + if !@isReply @thread.hide() return @@ -211,6 +213,8 @@ class Post Recursive.apply 'show', @, true Recursive.rm 'hide', @ + PostHiding.saveHiddenState @, {thisPost: true, hideRecursively: showRecursively, makeStub: !!@nodes.stub} + if !@isReply @thread.show() return