Remove comment expansion-related code.
This commit is contained in:
parent
a223568937
commit
d00597f53d
@ -9,7 +9,6 @@ Config =
|
||||
'Time Formatting': [true, 'Localize and format timestamps.']
|
||||
'Relative Post Dates': [false, 'Display dates like "3 minutes ago". Tooltip shows the timestamp.']
|
||||
'File Info Formatting': [true, 'Reformat the file information.']
|
||||
'Comment Expansion': [true, 'Add buttons to expand too long comments.']
|
||||
'Thread Expansion': [true, 'Add buttons to expand threads.']
|
||||
'Index Navigation': [false, 'Add buttons to navigate between threads.']
|
||||
'Reply Navigation': [false, 'Add buttons to navigate to top / bottom of thread.']
|
||||
|
||||
@ -106,7 +106,6 @@ Main =
|
||||
initFeature 'Reveal Spoilers', RevealSpoilers
|
||||
initFeature 'Auto-GIF', AutoGIF
|
||||
initFeature 'Image Hover', ImageHover
|
||||
initFeature 'Comment Expansion', ExpandComment
|
||||
initFeature 'Thread Expansion', ExpandThread
|
||||
initFeature 'Thread Excerpt', ThreadExcerpt
|
||||
initFeature 'Favicon', Favicon
|
||||
|
||||
@ -1,70 +0,0 @@
|
||||
ExpandComment =
|
||||
init: ->
|
||||
return if g.VIEW isnt 'index' or !Conf['Comment Expansion']
|
||||
|
||||
Post.callbacks.push
|
||||
name: 'Comment Expansion'
|
||||
cb: @node
|
||||
node: ->
|
||||
if a = $ '.abbr > a:not([onclick])', @nodes.comment
|
||||
$.on a, 'click', ExpandComment.cb
|
||||
cb: (e) ->
|
||||
e.preventDefault()
|
||||
ExpandComment.expand Get.postFromNode @
|
||||
expand: (post) ->
|
||||
if post.nodes.longComment and !post.nodes.longComment.parentNode
|
||||
$.replace post.nodes.shortComment, post.nodes.longComment
|
||||
post.nodes.comment = post.nodes.longComment
|
||||
return
|
||||
return unless a = $ '.abbr > a', post.nodes.comment
|
||||
a.textContent = "Post No.#{post} Loading..."
|
||||
$.cache "//api.4chan.org#{a.pathname}.json", -> ExpandComment.parse @, a, post
|
||||
contract: (post) ->
|
||||
return unless post.nodes.shortComment
|
||||
a = $ '.abbr > a', post.nodes.shortComment
|
||||
a.textContent = 'here'
|
||||
$.replace post.nodes.longComment, post.nodes.shortComment
|
||||
post.nodes.comment = post.nodes.shortComment
|
||||
parse: (req, a, post) ->
|
||||
{status} = req
|
||||
if status not in [200, 304]
|
||||
a.textContent = "Error #{req.statusText} (#{status})"
|
||||
return
|
||||
|
||||
posts = JSON.parse(req.response).posts
|
||||
Build.spoilerRange[g.BOARD] = posts[0].custom_spoiler
|
||||
|
||||
for postObj in posts
|
||||
break if postObj.no is post.ID
|
||||
if postObj.no isnt post.ID
|
||||
a.textContent = "Post No.#{post} not found."
|
||||
return
|
||||
|
||||
{comment} = post.nodes
|
||||
clone = comment.cloneNode false
|
||||
clone.innerHTML = postObj.com
|
||||
for quote in $$ '.quotelink', clone
|
||||
href = quote.getAttribute 'href'
|
||||
continue if href[0] is '/' # Cross-board quote, or board link
|
||||
quote.href = "/#{post.board}/res/#{href}" # Fix pathnames
|
||||
post.nodes.shortComment = comment
|
||||
$.replace comment, clone
|
||||
post.nodes.comment = post.nodes.longComment = clone
|
||||
post.parseComment()
|
||||
post.parseQuotes()
|
||||
if Conf['Resurrect Quotes']
|
||||
Quotify.node.call post
|
||||
if Conf['Quote Previewing']
|
||||
QuotePreview.node.call post
|
||||
if Conf['Quote Inlining']
|
||||
QuoteInline.node.call post
|
||||
if Conf['Mark OP Quotes']
|
||||
QuoteOP.node.call post
|
||||
if Conf['Mark Cross-thread Quotes']
|
||||
QuoteCT.node.call post
|
||||
if g.BOARD.ID is 'g'
|
||||
Fourchan.code.call post
|
||||
if g.BOARD.ID is 'sci'
|
||||
Fourchan.math.call post
|
||||
if Conf['Linkify']
|
||||
Linkify.node.call post
|
||||
@ -38,16 +38,13 @@ ExpandThread =
|
||||
|
||||
toggle: (thread) ->
|
||||
threadRoot = thread.OP.nodes.root.parentNode
|
||||
a = $ '.summary', threadRoot
|
||||
return unless a = $ '.summary', threadRoot
|
||||
if thread.ID of ExpandThread.statuses
|
||||
ExpandThread.contract thread, a, threadRoot
|
||||
else
|
||||
ExpandThread.expand thread, a, threadRoot
|
||||
expand: (thread, a, threadRoot) ->
|
||||
ExpandThread.statuses[thread] = status = {}
|
||||
for post in $$ '.thread > .postContainer', threadRoot
|
||||
ExpandComment.expand Get.postFromRoot post
|
||||
return unless a
|
||||
a.textContent = ExpandThread.text '...', a.textContent.match(/\d+/g)...
|
||||
status.req = $.cache "//api.4chan.org/#{thread.board}/res/#{thread}.json", ->
|
||||
delete status.req
|
||||
@ -67,13 +64,9 @@ ExpandThread =
|
||||
when 'b', 'vg' then 3
|
||||
when 't' then 1
|
||||
else 5
|
||||
posts = $$ '.thread > .replyContainer', threadRoot
|
||||
for post in [thread.OP.nodes.root].concat posts[-num..]
|
||||
ExpandComment.contract Get.postFromRoot post
|
||||
return unless a
|
||||
postsCount = 0
|
||||
filesCount = 0
|
||||
for reply in posts[...-num]
|
||||
for reply in $$('.thread > .replyContainer', threadRoot)[...-num]
|
||||
# rm clones
|
||||
inlined.click() while inlined = $ '.inlined', reply if Conf['Quote Inlining']
|
||||
postsCount++
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user