Change quote markers from textContent to styleable spans.
This commit is contained in:
parent
c4f1d3c5c7
commit
823ddb9d46
@ -26,7 +26,8 @@ QuoteBacklink =
|
||||
a = $.el 'a',
|
||||
href: Build.postURL @board.ID, @thread.ID, @ID
|
||||
className: if @isHidden then 'filtered backlink' else 'backlink'
|
||||
textContent: Conf['backlink'].replace(/%(?:id|%)/g, (x) => {'%id': @ID, '%%': '%'}[x]) + (if markYours then '\u00A0(You)' else '')
|
||||
textContent: Conf['backlink'].replace(/%(?:id|%)/g, (x) => {'%id': @ID, '%%': '%'}[x])
|
||||
$.add a, QuoteYou.mark.cloneNode(true) if markYours
|
||||
for quote in @quotes
|
||||
containers = [QuoteBacklink.getContainer quote]
|
||||
if (post = g.posts[quote]) and post.nodes.backlinkContainer
|
||||
|
||||
@ -6,7 +6,9 @@ QuoteCT =
|
||||
ExpandComment.callbacks.push @node
|
||||
|
||||
# \u00A0 is nbsp
|
||||
@text = '\u00A0(Cross-thread)'
|
||||
@mark = $.el 'span',
|
||||
textContent: '\u00A0(Cross-thread)'
|
||||
className: 'qmark-ct'
|
||||
Callbacks.Post.push
|
||||
name: 'Mark Cross-thread Quotes'
|
||||
cb: @node
|
||||
@ -19,7 +21,7 @@ QuoteCT =
|
||||
{boardID, threadID} = Get.postDataFromLink quotelink
|
||||
continue unless threadID # deadlink
|
||||
if @isClone
|
||||
quotelink.textContent = quotelink.textContent.replace QuoteCT.text, ''
|
||||
$.rm $('.qmark-ct', quotelink)
|
||||
if boardID is board.ID and threadID isnt thread.ID
|
||||
$.add quotelink, $.tn QuoteCT.text
|
||||
$.add quotelink, QuoteCT.mark.cloneNode(true)
|
||||
return
|
||||
|
||||
@ -6,7 +6,9 @@ QuoteOP =
|
||||
ExpandComment.callbacks.push @node
|
||||
|
||||
# \u00A0 is nbsp
|
||||
@text = '\u00A0(OP)'
|
||||
@mark = $.el 'span',
|
||||
textContent: '\u00A0(OP)'
|
||||
className: 'qmark-op'
|
||||
Callbacks.Post.push
|
||||
name: 'Mark OP Quotes'
|
||||
cb: @node
|
||||
@ -22,7 +24,7 @@ QuoteOP =
|
||||
if @isClone and @thread.fullID in quotes
|
||||
i = 0
|
||||
while quotelink = quotelinks[i++]
|
||||
quotelink.textContent = quotelink.textContent.replace QuoteOP.text, ''
|
||||
$.rm $('.qmark-op', quotelink)
|
||||
|
||||
{fullID} = @context.thread
|
||||
# add (OP) to quotes quoting this context's OP.
|
||||
@ -32,5 +34,5 @@ QuoteOP =
|
||||
while quotelink = quotelinks[i++]
|
||||
{boardID, postID} = Get.postDataFromLink quotelink
|
||||
if "#{boardID}.#{postID}" is fullID
|
||||
$.add quotelink, $.tn QuoteOP.text
|
||||
$.add quotelink, QuoteOP.mark.cloneNode(true)
|
||||
return
|
||||
|
||||
@ -22,7 +22,9 @@ QuoteYou =
|
||||
ExpandComment.callbacks.push @node
|
||||
|
||||
# \u00A0 is nbsp
|
||||
@text = '\u00A0(You)'
|
||||
@mark = $.el 'span',
|
||||
textContent: '\u00A0(You)'
|
||||
className: 'qmark-you'
|
||||
Callbacks.Post.push
|
||||
name: 'Mark Quotes of You'
|
||||
cb: @node
|
||||
@ -37,7 +39,7 @@ QuoteYou =
|
||||
return unless @quotes.length
|
||||
|
||||
for quotelink in @nodes.quotelinks when QuoteYou.db.get Get.postDataFromLink quotelink
|
||||
$.add quotelink, $.tn QuoteYou.text if Conf['Mark Quotes of You']
|
||||
$.add quotelink, QuoteYou.mark.cloneNode(true) if Conf['Mark Quotes of You']
|
||||
$.addClass quotelink, 'you'
|
||||
$.addClass @nodes.root, 'quotesYou'
|
||||
return
|
||||
|
||||
@ -65,7 +65,8 @@ Quotify =
|
||||
a = $.el 'a',
|
||||
href: Build.postURL boardID, post.thread.ID, postID
|
||||
className: 'quotelink deadlink'
|
||||
textContent: "#{quote}\u00A0(Dead)"
|
||||
textContent: quote
|
||||
$.add a, Post.deadMark.cloneNode(true)
|
||||
$.extend a.dataset, {boardID, threadID: post.thread.ID, postID}
|
||||
|
||||
else
|
||||
@ -76,7 +77,8 @@ Quotify =
|
||||
a = $.el 'a',
|
||||
href: redirect or 'javascript:;'
|
||||
className: 'deadlink'
|
||||
textContent: "#{quote}\u00A0(Dead)"
|
||||
textContent: quote
|
||||
$.add a, Post.deadMark.cloneNode(true)
|
||||
if fetchable
|
||||
# Make it function as a normal quote if we can fetch the post.
|
||||
$.addClass a, 'quotelink'
|
||||
@ -85,7 +87,7 @@ Quotify =
|
||||
@quotes.push quoteID unless quoteID in @quotes
|
||||
|
||||
unless a
|
||||
deadlink.textContent = "#{quote}\u00A0(Dead)"
|
||||
$.add deadlink, Post.deadMark.cloneNode(true)
|
||||
return
|
||||
|
||||
$.replace deadlink, a
|
||||
|
||||
@ -186,6 +186,12 @@ class Post
|
||||
MD5: thumb.dataset.md5
|
||||
isSpoiler: $.hasClass thumb.parentNode, 'imgspoiler'
|
||||
|
||||
@deadMark =
|
||||
# \u00A0 is nbsp
|
||||
$.el 'span',
|
||||
textContent: '\u00A0(Dead)'
|
||||
className: 'qmark-dead'
|
||||
|
||||
kill: (file) ->
|
||||
if file
|
||||
return if @isDead or @file.isDead
|
||||
@ -211,7 +217,7 @@ class Post
|
||||
# Get quotelinks/backlinks to this post
|
||||
# and paint them (Dead).
|
||||
for quotelink in Get.allQuotelinksLinkingTo @ when not $.hasClass quotelink, 'deadlink'
|
||||
quotelink.textContent = quotelink.textContent + '\u00A0(Dead)'
|
||||
$.add quotelink, Post.deadMark.cloneNode(true)
|
||||
$.addClass quotelink, 'deadlink'
|
||||
return
|
||||
|
||||
@ -232,7 +238,7 @@ class Post
|
||||
clone.resurrect()
|
||||
|
||||
for quotelink in Get.allQuotelinksLinkingTo @ when $.hasClass quotelink, 'deadlink'
|
||||
quotelink.textContent = quotelink.textContent.replace '\u00A0(Dead)', ''
|
||||
$.rm $('.qmark-dead', quotelink)
|
||||
$.rmClass quotelink, 'deadlink'
|
||||
return
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user