Add the Show replies index setting.

This commit is contained in:
Mayhem 2013-11-16 00:09:08 +01:00
parent 07bca42d63
commit 8afcac8d6f
5 changed files with 44 additions and 20 deletions

View File

@ -1,11 +1,15 @@
- Searching in the index is now possible and will show matched OPs by:
- comment
- subject
- filename
- name
- tripcode
- e-mail
- The elapsed time since the last index refresh is now indicated at the top of the index.
- More index navigation improvements:
- Searching in the index is now possible and will show matched OPs by:
<ul>
<li> comment
<li> subject
<li> filename
<li> name
<li> tripcode
<li> e-mail
</ul>
- The elapsed time since the last index refresh is now indicated at the top of the index.
- New setting: `Show replies`, enabled by default. Disable it to only show OPs in the index.
### 3.12.1 - *2013-11-04*

View File

@ -279,8 +279,13 @@ Build =
id: "t#{data.no}"
nodes = [if OP then OP.nodes.root else Build.postFromObject data, board.ID]
if data.omitted_posts
nodes.push Build.summary board.ID, data.no, data.omitted_posts, data.omitted_images
if data.omitted_posts or !Conf['Show Replies'] and data.replies
[posts, files] = if Conf['Show Replies']
[data.omitted_posts, data.omitted_images]
else
# XXX data.images is not accurate.
[data.replies, data.omitted_images + data.last_replies.filter((data) -> !!data.ext).length]
nodes.push Build.summary board.ID, data.no, posts, files
$.add root, nodes
root

View File

@ -142,6 +142,7 @@ Config =
Index:
'Index Mode': 'paged'
'Index Sort': 'bump'
'Show Replies': true
Header:
'Header auto-hide': false
'Bottom header': false

View File

@ -36,12 +36,19 @@ Index =
$.on input, 'change', $.cb.value
$.on input, 'change', @cb.sort
repliesEntry =
el: $.el 'label', innerHTML: '<input type=checkbox name="Show Replies"> Show replies'
input = repliesEntry.el.firstChild
input.checked = Conf['Show Replies']
$.on input, 'change', $.cb.checked
$.on input, 'change', @cb.replies
$.event 'AddMenuEntry',
type: 'header'
el: $.el 'span',
textContent: 'Index Navigation'
order: 90
subEntries: [modeEntry, sortEntry]
subEntries: [modeEntry, sortEntry, repliesEntry]
$.addClass doc, 'index-loading'
@update()
@ -85,6 +92,10 @@ Index =
sort: ->
Index.sort()
Index.buildIndex()
replies: ->
Index.buildThreads()
Index.sort()
Index.buildIndex()
popstate: (e) ->
pageNum = Index.getCurrentPage()
Index.pageLoad pageNum if Index.currentPage isnt pageNum
@ -328,7 +339,7 @@ Index =
else
nodes = Index.sortedNodes
$.rmAll Index.root
Index.buildReplies nodes
Index.buildReplies nodes if Conf['Show Replies']
$.event 'IndexBuild', nodes
$.add Index.root, nodes

View File

@ -50,16 +50,19 @@ ExpandThread =
a.textContent = ExpandThread.text '+', a.textContent.match(/\d+/g)... if a
return
num = if thread.isSticky
1
else switch g.BOARD.ID
# XXX boards config
when 'b', 'vg' then 3
when 't' then 1
else 5
replies = $$ '.thread > .replyContainer', threadRoot
if Conf['Show Replies']
num = if thread.isSticky
1
else switch g.BOARD.ID
# XXX boards config
when 'b', 'vg' then 3
when 't' then 1
else 5
replies = replies[...-num]
postsCount = 0
filesCount = 0
for reply in $$('.thread > .replyContainer', threadRoot)[...-num]
for reply in replies
# rm clones
inlined.click() while inlined = $ '.inlined', reply if Conf['Quote Inlining']
postsCount++