diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index bdc8b7854..3a831fb4d 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -6294,7 +6294,7 @@ if (!Conf['Reply Hiding Buttons']) { return; } - return $.add($('.postInfo', this.nodes.post), PostHiding.makeButton(this, 'hide')); + return $.add($('.postInfo', this.nodes.post), PostHiding.makeButton('hide')); }, menu: { init: function() { @@ -6462,18 +6462,16 @@ $.event('CloseMenu'); } }, - makeButton: function(post, type) { - var a, span; - span = $.el('span', { - className: "fa", - textContent: "" + (type === 'hide' ? '\uf068' : '\uf067') - }); + makeButton: function(type, noEvent) { + var a; a = $.el('a', { className: "" + type + "-reply-button", - href: 'javascript:;' + href: 'javascript:;', + innerHTML: "" + (type === 'hide' ? '\uf068' : '\uf067') + "" }); - $.add(a, span); - $.on(a, 'click', PostHiding.toggle); + if (!noEvent) { + $.on(a, 'click', PostHiding.toggle); + } return a; }, saveHiddenState: function(post, isHiding, thisPost, makeStub, hideRecursively) { @@ -6525,7 +6523,7 @@ post.nodes.root.hidden = true; return; } - a = PostHiding.makeButton(post, 'show'); + a = PostHiding.makeButton('show'); postInfo = Conf['Anonymize'] ? 'Anonymous' : $('.nameBlock', post.nodes.info).textContent; $.add(a, $.tn(" " + postInfo)); post.nodes.stub = $.el('div', { @@ -6819,11 +6817,8 @@ }, makeButton: function(thread, type) { var a; - a = $.el('a', { - className: "" + type + "-thread-button", - innerHTML: "" + (type === 'hide' ? '\uf068' : '\uf067') + "", - href: 'javascript:;' - }); + a = PostHiding.makeButton(type, true); + a.className = "" + type + "-thread-button"; a.dataset.fullID = thread.fullID; $.on(a, 'click', ThreadHiding.toggle); return a; diff --git a/builds/crx/script.js b/builds/crx/script.js index cf8228f67..e08a03f05 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -6297,7 +6297,7 @@ if (!Conf['Reply Hiding Buttons']) { return; } - return $.add($('.postInfo', this.nodes.post), PostHiding.makeButton(this, 'hide')); + return $.add($('.postInfo', this.nodes.post), PostHiding.makeButton('hide')); }, menu: { init: function() { @@ -6465,18 +6465,16 @@ $.event('CloseMenu'); } }, - makeButton: function(post, type) { - var a, span; - span = $.el('span', { - className: "fa", - textContent: "" + (type === 'hide' ? '\uf068' : '\uf067') - }); + makeButton: function(type, noEvent) { + var a; a = $.el('a', { className: "" + type + "-reply-button", - href: 'javascript:;' + href: 'javascript:;', + innerHTML: "" + (type === 'hide' ? '\uf068' : '\uf067') + "" }); - $.add(a, span); - $.on(a, 'click', PostHiding.toggle); + if (!noEvent) { + $.on(a, 'click', PostHiding.toggle); + } return a; }, saveHiddenState: function(post, isHiding, thisPost, makeStub, hideRecursively) { @@ -6528,7 +6526,7 @@ post.nodes.root.hidden = true; return; } - a = PostHiding.makeButton(post, 'show'); + a = PostHiding.makeButton('show'); postInfo = Conf['Anonymize'] ? 'Anonymous' : $('.nameBlock', post.nodes.info).textContent; $.add(a, $.tn(" " + postInfo)); post.nodes.stub = $.el('div', { @@ -6822,11 +6820,8 @@ }, makeButton: function(thread, type) { var a; - a = $.el('a', { - className: "" + type + "-thread-button", - innerHTML: "" + (type === 'hide' ? '\uf068' : '\uf067') + "", - href: 'javascript:;' - }); + a = PostHiding.makeButton(type, true); + a.className = "" + type + "-thread-button"; a.dataset.fullID = thread.fullID; $.on(a, 'click', ThreadHiding.toggle); return a; diff --git a/src/Filtering/PostHiding.coffee b/src/Filtering/PostHiding.coffee index 3f7f22dfa..eef239038 100644 --- a/src/Filtering/PostHiding.coffee +++ b/src/Filtering/PostHiding.coffee @@ -19,7 +19,7 @@ PostHiding = Recursive.apply PostHiding.hide, @, data.makeStub, true Recursive.add PostHiding.hide, @, data.makeStub, true return unless Conf['Reply Hiding Buttons'] - $.add $('.postInfo', @nodes.post), PostHiding.makeButton @, 'hide' + $.add $('.postInfo', @nodes.post), PostHiding.makeButton 'hide' menu: init: -> @@ -151,15 +151,12 @@ PostHiding = $.event 'CloseMenu' return - makeButton: (post, type) -> - span = $.el 'span', - className: "fa" - textContent: "#{if type is 'hide' then '\uf068' else '\uf067'}" + makeButton: (type, noEvent) -> a = $.el 'a', className: "#{type}-reply-button" href: 'javascript:;' - $.add a, span - $.on a, 'click', PostHiding.toggle + innerHTML: "#{if type is 'hide' then '\uf068' else '\uf067'}" + $.on a, 'click', PostHiding.toggle unless noEvent a saveHiddenState: (post, isHiding, thisPost, makeStub, hideRecursively) -> @@ -196,7 +193,7 @@ PostHiding = post.nodes.root.hidden = true return - a = PostHiding.makeButton post, 'show' + a = PostHiding.makeButton 'show' postInfo = if Conf['Anonymize'] 'Anonymous' diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index b87ed9e03..b975417a2 100644 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -144,13 +144,12 @@ ThreadHiding = return makeButton: (thread, type) -> - a = $.el 'a', - className: "#{type}-thread-button" - innerHTML: "#{if type is 'hide' then '\uf068' else '\uf067'}" - href: 'javascript:;' + a = PostHiding.makeButton type, true + a.className = "#{type}-thread-button" a.dataset.fullID = thread.fullID - $.on a, 'click', ThreadHiding.toggle + $.on a, 'click', ThreadHiding.toggle a + makeStub: (thread, root) -> numReplies = $$('.thread > .replyContainer', root).length numReplies += +summary.textContent.match /\d+/ if summary = $ '.summary', root