Anchor hidden threads on the index.
This commit is contained in:
parent
d90f461dc1
commit
f17f9fd441
@ -1,3 +1,6 @@
|
||||
- More index navigation improvements:
|
||||
- New setting: `Anchor Hidden Threads`, enabled by default. Hidden threads will be moved at the end of the index to fill the first pages.
|
||||
|
||||
### 3.14.3 - *2013-12-09*
|
||||
|
||||
- Minor bug fixes.
|
||||
|
||||
@ -143,6 +143,7 @@ Config =
|
||||
'Index Mode': 'paged'
|
||||
'Index Sort': 'bump'
|
||||
'Show Replies': true
|
||||
'Anchor Hidden Threads': true
|
||||
Header:
|
||||
'Header auto-hide': false
|
||||
'Header auto-hide on scroll': false
|
||||
|
||||
@ -38,17 +38,25 @@ Index =
|
||||
|
||||
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
|
||||
anchorEntry =
|
||||
el: $.el 'label', innerHTML: '<input type=checkbox name="Anchor Hidden Threads" title="Move hidden threads at the end of the index."> Anchor hidden threads'
|
||||
for label in [repliesEntry, anchorEntry]
|
||||
input = label.el.firstChild
|
||||
{name} = input
|
||||
input.checked = Conf[name]
|
||||
$.on input, 'change', $.cb.checked
|
||||
switch name
|
||||
when 'Show Replies'
|
||||
$.on input, 'change', @cb.replies
|
||||
when 'Anchor Hidden Threads'
|
||||
$.on input, 'change', @cb.sort
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
type: 'header'
|
||||
el: $.el 'span',
|
||||
textContent: 'Index Navigation'
|
||||
order: 90
|
||||
subEntries: [modeEntry, sortEntry, repliesEntry]
|
||||
subEntries: [modeEntry, sortEntry, repliesEntry, anchorEntry]
|
||||
|
||||
$.addClass doc, 'index-loading'
|
||||
@update()
|
||||
@ -318,12 +326,17 @@ Index =
|
||||
Index.sortedNodes.push Index.nodes[i], Index.nodes[i + 1]
|
||||
if Index.isSearching
|
||||
Index.sortedNodes = Index.querySearch(Index.searchInput.value) or Index.sortedNodes
|
||||
# Put the sticky threads on top of the index.
|
||||
# Move non-hidden threads on top of the index.
|
||||
if Conf['Anchor Hidden Threads']
|
||||
offset = 0
|
||||
for threadRoot, i in Index.sortedNodes by 2 when not Get.threadFromRoot(threadRoot).isHidden
|
||||
Index.sortedNodes.splice offset++ * 2, 0, Index.sortedNodes.splice(i, 2)...
|
||||
# Move sticky threads on top of the index.
|
||||
offset = 0
|
||||
for threadRoot, i in Index.sortedNodes by 2 when Get.threadFromRoot(threadRoot).isSticky
|
||||
Index.sortedNodes.splice offset++ * 2, 0, Index.sortedNodes.splice(i, 2)...
|
||||
return unless Conf['Filter']
|
||||
# Put the highlighted thread & <hr> on top of the index
|
||||
# Move highlighted threads & <hr> on top of the index
|
||||
# while keeping the original order they appear in.
|
||||
offset = 0
|
||||
for threadRoot, i in Index.sortedNodes by 2 when Get.threadFromRoot(threadRoot).isOnTop
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user