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