diff --git a/src/Filtering/PostHiding.coffee b/src/Filtering/PostHiding.coffee index 117f42241..79705e030 100755 --- a/src/Filtering/PostHiding.coffee +++ b/src/Filtering/PostHiding.coffee @@ -190,12 +190,7 @@ PostHiding = return a = PostHiding.makeButton post, 'show' - postInfo = - if Conf['Anonymize'] - 'Anonymous' - else - $('.nameBlock', post.nodes.info).textContent - $.add a, $.tn " #{postInfo}" + $.add a, $.tn " #{post.info.nameBlock}" post.nodes.stub = $.el 'div', className: 'stub' $.add post.nodes.stub, a diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index 4721da7f9..b6f5888e0 100755 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -135,13 +135,9 @@ ThreadHiding = makeStub: (thread, root) -> numReplies = $$('.thread > .replyContainer', root).length numReplies += +summary.textContent.match /\d+/ if summary = $ '.summary', root - opInfo = if Conf['Anonymize'] - 'Anonymous' - else - $('.nameBlock', thread.OP.nodes.info).textContent a = ThreadHiding.makeButton thread, 'show' - $.add a, $.tn " #{opInfo} (#{if numReplies is 1 then '1 reply' else "#{numReplies} replies"})" + $.add a, $.tn " #{thread.OP.info.nameBlock} (#{if numReplies is 1 then '1 reply' else "#{numReplies} replies"})" thread.stub = $.el 'div', className: 'stub' if Conf['Menu'] diff --git a/src/General/Get.coffee b/src/General/Get.coffee index dc2192452..849b55153 100755 --- a/src/General/Get.coffee +++ b/src/General/Get.coffee @@ -4,8 +4,7 @@ Get = excerpt = "/#{thread.board}/ - " + ( OP.info.subject?.trim() or OP.info.comment.replace(/\n+/g, ' // ') or - Conf['Anonymize'] and 'Anonymous' or - $('.nameBlock', OP.nodes.info).textContent.trim()) + OP.info.nameBlock) return "#{excerpt[...70]}..." if excerpt.length > 73 excerpt threadFromRoot: (root) -> diff --git a/src/General/lib/post.class b/src/General/lib/post.class index 1b04d02ed..291093e3f 100755 --- a/src/General/lib/post.class +++ b/src/General/lib/post.class @@ -36,6 +36,7 @@ class Post root: root post: post info: info + nameBlock: $ '.nameBlock', info comment: $ '.postMessage', post links: [] quotelinks: [] @@ -49,6 +50,10 @@ class Post @thread.kill() if @thread.isArchived @info = {} + @info.nameBlock = if Conf['Anonymize'] + 'Anonymous' + else + @nodes.nameBlock.textContent.trim() if subject = $ '.subject', info @nodes.subject = subject @info.subject = subject.textContent diff --git a/src/Monitoring/MarkNewIPs.coffee b/src/Monitoring/MarkNewIPs.coffee index 2fdc4be8c..1c6a4386f 100644 --- a/src/Monitoring/MarkNewIPs.coffee +++ b/src/Monitoring/MarkNewIPs.coffee @@ -43,12 +43,10 @@ MarkNewIPs = counter = $.el 'span', className: 'ip-counter' textContent: "(#{ipCount})" - nameBlock = $ '.nameBlock', post.nodes.info - nameBlock.title = "This is the #{ipCount}#{suffix} IP in the thread." - $.add nameBlock, [$.tn(' '), counter] + post.nodes.nameBlock.title = "This is the #{ipCount}#{suffix} IP in the thread." + $.add post.nodes.nameBlock, [$.tn(' '), counter] $.addClass post.nodes.root, 'new-ip' markOld: (post) -> - nameBlock = $ '.nameBlock', post.nodes.info - nameBlock.title = 'Not the first post from this IP.' + post.nodes.nameBlock.title = 'Not the first post from this IP.' $.addClass post.nodes.root, 'old-ip' diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee index a8db0b9ec..1c0ccdbcf 100755 --- a/src/Monitoring/Unread.coffee +++ b/src/Monitoring/Unread.coffee @@ -100,11 +100,7 @@ Unread = openNotification: (post) -> return unless Header.areNotificationsEnabled - name = if Conf['Anonymize'] - 'Anonymous' - else - $('.nameBlock', post.nodes.info).textContent.trim() - notif = new Notification "#{name} replied to you", + notif = new Notification "#{post.info.nameBlock} replied to you", body: post.info[if Conf['Remove Spoilers'] or Conf['Reveal Spoilers'] then 'comment' else 'commentSpoilered'] icon: Favicon.logo notif.onclick = ->