Merge from Appchan X: src/Quotelinks
deferred: QuoteBacklinks.coffee, QuoteMarkers.coffee, and related changes (including change in QuoteInline.qiQuote)
This commit is contained in:
parent
f89904f4e4
commit
742184d2c0
@ -26,8 +26,10 @@ QuoteInline =
|
|||||||
return
|
return
|
||||||
|
|
||||||
qiQuote: (link, hidden) ->
|
qiQuote: (link, hidden) ->
|
||||||
|
name = "hashlink"
|
||||||
|
name += " filtered" if hidden
|
||||||
$.el 'a',
|
$.el 'a',
|
||||||
className: "hashlink#{if hidden then ' filtered' else ''}"
|
className: name
|
||||||
textContent: '#'
|
textContent: '#'
|
||||||
href: link.href
|
href: link.href
|
||||||
|
|
||||||
@ -39,7 +41,7 @@ QuoteInline =
|
|||||||
if $.hasClass @, 'inlined'
|
if $.hasClass @, 'inlined'
|
||||||
QuoteInline.rm @, boardID, threadID, postID, context
|
QuoteInline.rm @, boardID, threadID, postID, context
|
||||||
else
|
else
|
||||||
return if $.x "ancestor::div[@id='p#{postID}']", @
|
return if $.x "ancestor::div[@id='pc#{postID}']", @
|
||||||
QuoteInline.add @, boardID, threadID, postID, context
|
QuoteInline.add @, boardID, threadID, postID, context
|
||||||
@classList.toggle 'inlined'
|
@classList.toggle 'inlined'
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
QuotePreview =
|
QuotePreview =
|
||||||
init: ->
|
init: ->
|
||||||
return if g.VIEW not in ['index', 'thread'] or !Conf['Quote Previewing']
|
return unless g.VIEW in ['index', 'thread'] and Conf['Quote Previewing']
|
||||||
|
|
||||||
if Conf['Comment Expansion']
|
if Conf['Comment Expansion']
|
||||||
ExpandComment.callbacks.push @node
|
ExpandComment.callbacks.push @node
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
QuoteStrikeThrough =
|
QuoteStrikeThrough =
|
||||||
init: ->
|
init: ->
|
||||||
return if g.VIEW not in ['index', 'thread'] or !Conf['Reply Hiding Buttons'] and !(Conf['Menu'] and Conf['Reply Hiding Link']) and !Conf['Filter']
|
return unless g.VIEW in ['index', 'thread'] and
|
||||||
|
(Conf['Reply Hiding Buttons'] or (Conf['Menu'] and Conf['Reply Hiding Link']) or Conf['Filter'])
|
||||||
|
|
||||||
Post.callbacks.push
|
Post.callbacks.push
|
||||||
name: 'Strike-through Quotes'
|
name: 'Strike-through Quotes'
|
||||||
|
|||||||
@ -15,11 +15,10 @@ QuoteThreading =
|
|||||||
hidden: true
|
hidden: true
|
||||||
$.extend @threadNewLink, <%= html('<a href="javascript:;">Thread New Posts</a>') %>
|
$.extend @threadNewLink, <%= html('<a href="javascript:;">Thread New Posts</a>') %>
|
||||||
|
|
||||||
$.on $('input', @controls), 'change', ->
|
@input = $('input', @controls)
|
||||||
QuoteThreading.rethread @checked
|
|
||||||
$.on @threadNewLink.firstElementChild, 'click', ->
|
$.on @input, 'change', @cb.thread
|
||||||
QuoteThreading.threadNewLink.hidden = true
|
$.on @threadNewLink.firstElementChild, 'click', @cb.click
|
||||||
QuoteThreading.rethread true
|
|
||||||
|
|
||||||
Header.menu.addEntry @entry =
|
Header.menu.addEntry @entry =
|
||||||
el: @controls
|
el: @controls
|
||||||
@ -45,10 +44,10 @@ QuoteThreading =
|
|||||||
node: ->
|
node: ->
|
||||||
return if @isFetchedQuote or @isClone or !@isReply
|
return if @isFetchedQuote or @isClone or !@isReply
|
||||||
{thread} = QuoteThreading
|
{thread} = QuoteThreading
|
||||||
parents = for quote in @quotes
|
parents = (parent for quote in @quotes when (parent = g.posts[quote]) and
|
||||||
parent = g.posts[quote]
|
not parent.isFetchedQuote and parent.isReply and parent.ID < @ID
|
||||||
continue if !parent or parent.isFetchedQuote or !parent.isReply or parent.ID >= @ID
|
)
|
||||||
parent
|
|
||||||
if parents.length is 1
|
if parents.length is 1
|
||||||
QuoteThreading.parent[@fullID] = parents[0]
|
QuoteThreading.parent[@fullID] = parents[0]
|
||||||
|
|
||||||
@ -65,9 +64,10 @@ QuoteThreading =
|
|||||||
!QuoteThreading.inserted[post.fullID]
|
!QuoteThreading.inserted[post.fullID]
|
||||||
|
|
||||||
descendants = QuoteThreading.descendants post
|
descendants = QuoteThreading.descendants post
|
||||||
if !Unread.posts.has(parent.ID) and descendants.some((x) -> Unread.posts.has(x.ID))
|
if !Unread.posts.has(parent.ID)
|
||||||
QuoteThreading.threadNewLink.hidden = false
|
if (do -> return true for x in descendants when Unread.posts.has x.ID)
|
||||||
return false
|
QuoteThreading.threadNewLink.hidden = false
|
||||||
|
return false
|
||||||
|
|
||||||
{order} = Unread
|
{order} = Unread
|
||||||
children = (QuoteThreading.children[parent.fullID] or= [])
|
children = (QuoteThreading.children[parent.fullID] or= [])
|
||||||
@ -107,7 +107,7 @@ QuoteThreading =
|
|||||||
posts.forEach QuoteThreading.insert
|
posts.forEach QuoteThreading.insert
|
||||||
else
|
else
|
||||||
nodes = []
|
nodes = []
|
||||||
Unread.order = new RandomAccessList
|
Unread.order = new RandomAccessList()
|
||||||
QuoteThreading.inserted = {}
|
QuoteThreading.inserted = {}
|
||||||
posts.forEach (post) ->
|
posts.forEach (post) ->
|
||||||
return if post.isFetchedQuote
|
return if post.isFetchedQuote
|
||||||
@ -125,3 +125,9 @@ QuoteThreading =
|
|||||||
Unread.setLine true
|
Unread.setLine true
|
||||||
Unread.read()
|
Unread.read()
|
||||||
Unread.update()
|
Unread.update()
|
||||||
|
|
||||||
|
cb:
|
||||||
|
thread: -> QuoteThreading.rethread QuoteThreading.input.checked
|
||||||
|
click: ->
|
||||||
|
QuoteThreading.threadNewLink.hidden = true
|
||||||
|
QuoteThreading.rethread true
|
||||||
|
|||||||
@ -74,7 +74,9 @@ Quotify =
|
|||||||
|
|
||||||
@quotes.push quoteID unless quoteID in @quotes
|
@quotes.push quoteID unless quoteID in @quotes
|
||||||
|
|
||||||
return deadlink.textContent = "#{quote}\u00A0(Dead)" unless a
|
unless a
|
||||||
|
deadlink.textContent = "#{quote}\u00A0(Dead)"
|
||||||
|
return
|
||||||
|
|
||||||
$.replace deadlink, a
|
$.replace deadlink, a
|
||||||
if $.hasClass a, 'quotelink'
|
if $.hasClass a, 'quotelink'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user