From 9b5cb52619bf00ab70f128ef828a0682688ab142 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Tue, 6 Aug 2013 12:14:23 -0700 Subject: [PATCH] Personal choices --- builds/4chan-X.user.js | 10 +--------- builds/crx/script.js | 10 +--------- src/Miscellaneous/ExpandThread.coffee | 9 ++++----- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 497294377..6dbe56c2c 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -8627,15 +8627,7 @@ return $.replace(span, a); }, text: function(status, posts, files) { - var text; - - text = [status]; - text.push("" + posts + " post" + (posts > 1 ? 's' : '')); - if (+files) { - text.push("and " + files + " image repl" + (files > 1 ? 'ies' : 'y')); - } - text.push(status === '-' ? 'shown' : 'omitted'); - return text.join(' ') + '.'; + return ("" + status + " " + posts + " post" + (posts > 1 ? 's' : '')) + (+files ? " and " + files + " image repl" + (files > 1 ? 'ies' : 'y') : "") + (" " + (status === '-' ? 'shown' : 'omitted') + "."); }, cbToggle: function() { return ExpandThread.toggle(Get.threadFromRoot(this.parentNode)); diff --git a/builds/crx/script.js b/builds/crx/script.js index 4816da6d1..593d72a9f 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -8612,15 +8612,7 @@ return $.replace(span, a); }, text: function(status, posts, files) { - var text; - - text = [status]; - text.push("" + posts + " post" + (posts > 1 ? 's' : '')); - if (+files) { - text.push("and " + files + " image repl" + (files > 1 ? 'ies' : 'y')); - } - text.push(status === '-' ? 'shown' : 'omitted'); - return text.join(' ') + '.'; + return ("" + status + " " + posts + " post" + (posts > 1 ? 's' : '')) + (+files ? " and " + files + " image repl" + (files > 1 ? 'ies' : 'y') : "") + (" " + (status === '-' ? 'shown' : 'omitted') + "."); }, cbToggle: function() { return ExpandThread.toggle(Get.threadFromRoot(this.parentNode)); diff --git a/src/Miscellaneous/ExpandThread.coffee b/src/Miscellaneous/ExpandThread.coffee index 4d63a2989..3f3a7c19a 100644 --- a/src/Miscellaneous/ExpandThread.coffee +++ b/src/Miscellaneous/ExpandThread.coffee @@ -5,6 +5,7 @@ ExpandThread = Thread::callbacks.push name: 'Thread Expansion' cb: @node + node: -> return unless span = $.x 'following-sibling::span[contains(@class,"summary")][1]', @OP.nodes.root [posts, files] = span.textContent.match /\d+/g @@ -16,11 +17,9 @@ ExpandThread = $.replace span, a text: (status, posts, files) -> - text = [status] - text.push "#{posts} post#{if posts > 1 then 's' else ''}" - text.push "and #{files} image repl#{if files > 1 then 'ies' else 'y'}" if +files - text.push if status is '-' then 'shown' else 'omitted' - text.join(' ') + '.' + "#{status} #{posts} post#{if posts > 1 then 's' else ''}" + + (if +files then " and #{files} image repl#{if files > 1 then 'ies' else 'y'}" else "") + + " #{if status is '-' then 'shown' else 'omitted'}." cbToggle: -> ExpandThread.toggle Get.threadFromRoot @parentNode