Move nameBlock into post class.
This commit is contained in:
parent
5299cbf50b
commit
4ac31962a2
@ -190,12 +190,7 @@ PostHiding =
|
|||||||
return
|
return
|
||||||
|
|
||||||
a = PostHiding.makeButton post, 'show'
|
a = PostHiding.makeButton post, 'show'
|
||||||
postInfo =
|
$.add a, $.tn " #{post.info.nameBlock}"
|
||||||
if Conf['Anonymize']
|
|
||||||
'Anonymous'
|
|
||||||
else
|
|
||||||
$('.nameBlock', post.nodes.info).textContent
|
|
||||||
$.add a, $.tn " #{postInfo}"
|
|
||||||
post.nodes.stub = $.el 'div',
|
post.nodes.stub = $.el 'div',
|
||||||
className: 'stub'
|
className: 'stub'
|
||||||
$.add post.nodes.stub, a
|
$.add post.nodes.stub, a
|
||||||
|
|||||||
@ -135,13 +135,9 @@ ThreadHiding =
|
|||||||
makeStub: (thread, root) ->
|
makeStub: (thread, root) ->
|
||||||
numReplies = $$('.thread > .replyContainer', root).length
|
numReplies = $$('.thread > .replyContainer', root).length
|
||||||
numReplies += +summary.textContent.match /\d+/ if summary = $ '.summary', root
|
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'
|
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',
|
thread.stub = $.el 'div',
|
||||||
className: 'stub'
|
className: 'stub'
|
||||||
if Conf['Menu']
|
if Conf['Menu']
|
||||||
|
|||||||
@ -4,8 +4,7 @@ Get =
|
|||||||
excerpt = "/#{thread.board}/ - " + (
|
excerpt = "/#{thread.board}/ - " + (
|
||||||
OP.info.subject?.trim() or
|
OP.info.subject?.trim() or
|
||||||
OP.info.comment.replace(/\n+/g, ' // ') or
|
OP.info.comment.replace(/\n+/g, ' // ') or
|
||||||
Conf['Anonymize'] and 'Anonymous' or
|
OP.info.nameBlock)
|
||||||
$('.nameBlock', OP.nodes.info).textContent.trim())
|
|
||||||
return "#{excerpt[...70]}..." if excerpt.length > 73
|
return "#{excerpt[...70]}..." if excerpt.length > 73
|
||||||
excerpt
|
excerpt
|
||||||
threadFromRoot: (root) ->
|
threadFromRoot: (root) ->
|
||||||
|
|||||||
@ -36,6 +36,7 @@ class Post
|
|||||||
root: root
|
root: root
|
||||||
post: post
|
post: post
|
||||||
info: info
|
info: info
|
||||||
|
nameBlock: $ '.nameBlock', info
|
||||||
comment: $ '.postMessage', post
|
comment: $ '.postMessage', post
|
||||||
links: []
|
links: []
|
||||||
quotelinks: []
|
quotelinks: []
|
||||||
@ -49,6 +50,10 @@ class Post
|
|||||||
@thread.kill() if @thread.isArchived
|
@thread.kill() if @thread.isArchived
|
||||||
|
|
||||||
@info = {}
|
@info = {}
|
||||||
|
@info.nameBlock = if Conf['Anonymize']
|
||||||
|
'Anonymous'
|
||||||
|
else
|
||||||
|
@nodes.nameBlock.textContent.trim()
|
||||||
if subject = $ '.subject', info
|
if subject = $ '.subject', info
|
||||||
@nodes.subject = subject
|
@nodes.subject = subject
|
||||||
@info.subject = subject.textContent
|
@info.subject = subject.textContent
|
||||||
|
|||||||
@ -43,12 +43,10 @@ MarkNewIPs =
|
|||||||
counter = $.el 'span',
|
counter = $.el 'span',
|
||||||
className: 'ip-counter'
|
className: 'ip-counter'
|
||||||
textContent: "(#{ipCount})"
|
textContent: "(#{ipCount})"
|
||||||
nameBlock = $ '.nameBlock', post.nodes.info
|
post.nodes.nameBlock.title = "This is the #{ipCount}#{suffix} IP in the thread."
|
||||||
nameBlock.title = "This is the #{ipCount}#{suffix} IP in the thread."
|
$.add post.nodes.nameBlock, [$.tn(' '), counter]
|
||||||
$.add nameBlock, [$.tn(' '), counter]
|
|
||||||
$.addClass post.nodes.root, 'new-ip'
|
$.addClass post.nodes.root, 'new-ip'
|
||||||
|
|
||||||
markOld: (post) ->
|
markOld: (post) ->
|
||||||
nameBlock = $ '.nameBlock', post.nodes.info
|
post.nodes.nameBlock.title = 'Not the first post from this IP.'
|
||||||
nameBlock.title = 'Not the first post from this IP.'
|
|
||||||
$.addClass post.nodes.root, 'old-ip'
|
$.addClass post.nodes.root, 'old-ip'
|
||||||
|
|||||||
@ -100,11 +100,7 @@ Unread =
|
|||||||
|
|
||||||
openNotification: (post) ->
|
openNotification: (post) ->
|
||||||
return unless Header.areNotificationsEnabled
|
return unless Header.areNotificationsEnabled
|
||||||
name = if Conf['Anonymize']
|
notif = new Notification "#{post.info.nameBlock} replied to you",
|
||||||
'Anonymous'
|
|
||||||
else
|
|
||||||
$('.nameBlock', post.nodes.info).textContent.trim()
|
|
||||||
notif = new Notification "#{name} replied to you",
|
|
||||||
body: post.info[if Conf['Remove Spoilers'] or Conf['Reveal Spoilers'] then 'comment' else 'commentSpoilered']
|
body: post.info[if Conf['Remove Spoilers'] or Conf['Reveal Spoilers'] then 'comment' else 'commentSpoilered']
|
||||||
icon: Favicon.logo
|
icon: Favicon.logo
|
||||||
notif.onclick = ->
|
notif.onclick = ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user