Expand at least comments when the thread itself cannot be expanded. #968
This commit is contained in:
parent
c79bb318b2
commit
caa79b5089
@ -1101,13 +1101,13 @@ ThreadHiding =
|
|||||||
|
|
||||||
if (ThreadHiding.db.data.lastChecked or 0) > Date.now() - $.MINUTE
|
if (ThreadHiding.db.data.lastChecked or 0) > Date.now() - $.MINUTE
|
||||||
# Was cleaned just now.
|
# Was cleaned just now.
|
||||||
ThreadHiding.cleanCatalog()
|
ThreadHiding.cleanCatalog hiddenThreadsOnCatalog
|
||||||
|
|
||||||
ThreadHiding.db.set
|
ThreadHiding.db.set
|
||||||
boardID: g.BOARD.ID
|
boardID: g.BOARD.ID
|
||||||
val: hiddenThreads
|
val: hiddenThreads
|
||||||
|
|
||||||
cleanCatalog: ->
|
cleanCatalog: (hiddenThreadsOnCatalog) ->
|
||||||
# We need to clean hidden threads on the catalog ourselves,
|
# We need to clean hidden threads on the catalog ourselves,
|
||||||
# otherwise if we don't visit the catalog regularly
|
# otherwise if we don't visit the catalog regularly
|
||||||
# it will pollute the localStorage and our data.
|
# it will pollute the localStorage and our data.
|
||||||
@ -3505,36 +3505,45 @@ ExpandThread =
|
|||||||
|
|
||||||
toggle: (thread) ->
|
toggle: (thread) ->
|
||||||
threadRoot = thread.OP.nodes.root.parentNode
|
threadRoot = thread.OP.nodes.root.parentNode
|
||||||
url = "//api.4chan.org/#{thread.board}/res/#{thread}.json"
|
a = $ '.summary', threadRoot
|
||||||
a = $ '.summary', threadRoot
|
|
||||||
|
|
||||||
text = a.textContent
|
|
||||||
switch text[0]
|
switch thread.isExpanded
|
||||||
when '+'
|
when false, undefined
|
||||||
a.textContent = text.replace '+', '× Loading...'
|
thread.isExpanded = 'loading'
|
||||||
$.cache url, -> ExpandThread.parse @, thread, a
|
|
||||||
for post in $$ '.thread > .postContainer', threadRoot
|
for post in $$ '.thread > .postContainer', threadRoot
|
||||||
ExpandComment.expand Get.postFromRoot post
|
ExpandComment.expand Get.postFromRoot post
|
||||||
|
unless a
|
||||||
|
thread.isExpanded = true
|
||||||
|
return
|
||||||
|
thread.isExpanded = 'loading'
|
||||||
|
a.textContent = a.textContent.replace '+', '× Loading...'
|
||||||
|
$.cache "//api.4chan.org/#{thread.board}/res/#{thread}.json", ->
|
||||||
|
ExpandThread.parse @, thread, a
|
||||||
|
|
||||||
when '×'
|
when 'loading'
|
||||||
a.textContent = text.replace '× Loading...', '+'
|
thread.isExpanded = false
|
||||||
|
return unless a
|
||||||
|
a.textContent = a.textContent.replace '× Loading...', '+'
|
||||||
|
|
||||||
when '-'
|
when true
|
||||||
a.textContent = text.replace '-', '+'
|
thread.isExpanded = false
|
||||||
#goddamit moot
|
if a
|
||||||
num = if thread.isSticky
|
a.textContent = a.textContent.replace '-', '+'
|
||||||
1
|
#goddamit moot
|
||||||
else switch g.BOARD.ID
|
num = if thread.isSticky
|
||||||
# XXX boards config
|
1
|
||||||
when 'b', 'vg', 'q' then 3
|
else switch g.BOARD.ID
|
||||||
when 't' then 1
|
# XXX boards config
|
||||||
else 5
|
when 'b', 'vg', 'q' then 3
|
||||||
replies = $$('.thread > .replyContainer', threadRoot)[...-num]
|
when 't' then 1
|
||||||
for reply in replies
|
else 5
|
||||||
if Conf['Quote Inlining']
|
replies = $$('.thread > .replyContainer', threadRoot)[...-num]
|
||||||
# rm clones
|
for reply in replies
|
||||||
inlined.click() while inlined = $ '.inlined', reply
|
if Conf['Quote Inlining']
|
||||||
$.rm reply
|
# rm clones
|
||||||
|
inlined.click() while inlined = $ '.inlined', reply
|
||||||
|
$.rm reply
|
||||||
for post in $$ '.thread > .postContainer', threadRoot
|
for post in $$ '.thread > .postContainer', threadRoot
|
||||||
ExpandComment.contract Get.postFromRoot post
|
ExpandComment.contract Get.postFromRoot post
|
||||||
return
|
return
|
||||||
@ -3547,6 +3556,7 @@ ExpandThread =
|
|||||||
$.off a, 'click', ExpandThread.cb.toggle
|
$.off a, 'click', ExpandThread.cb.toggle
|
||||||
return
|
return
|
||||||
|
|
||||||
|
thread.isExpanded = true
|
||||||
a.textContent = a.textContent.replace '× Loading...', '-'
|
a.textContent = a.textContent.replace '× Loading...', '-'
|
||||||
|
|
||||||
posts = JSON.parse(req.response).posts
|
posts = JSON.parse(req.response).posts
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user