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*
|
### 3.14.3 - *2013-12-09*
|
||||||
|
|
||||||
- Minor bug fixes.
|
- Minor bug fixes.
|
||||||
|
|||||||
@ -143,6 +143,7 @@ Config =
|
|||||||
'Index Mode': 'paged'
|
'Index Mode': 'paged'
|
||||||
'Index Sort': 'bump'
|
'Index Sort': 'bump'
|
||||||
'Show Replies': true
|
'Show Replies': true
|
||||||
|
'Anchor Hidden Threads': true
|
||||||
Header:
|
Header:
|
||||||
'Header auto-hide': false
|
'Header auto-hide': false
|
||||||
'Header auto-hide on scroll': false
|
'Header auto-hide on scroll': false
|
||||||
|
|||||||
@ -38,17 +38,25 @@ Index =
|
|||||||
|
|
||||||
repliesEntry =
|
repliesEntry =
|
||||||
el: $.el 'label', innerHTML: '<input type=checkbox name="Show Replies"> Show replies'
|
el: $.el 'label', innerHTML: '<input type=checkbox name="Show Replies"> Show replies'
|
||||||
input = repliesEntry.el.firstChild
|
anchorEntry =
|
||||||
input.checked = Conf['Show Replies']
|
el: $.el 'label', innerHTML: '<input type=checkbox name="Anchor Hidden Threads" title="Move hidden threads at the end of the index."> Anchor hidden threads'
|
||||||
$.on input, 'change', $.cb.checked
|
for label in [repliesEntry, anchorEntry]
|
||||||
$.on input, 'change', @cb.replies
|
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',
|
$.event 'AddMenuEntry',
|
||||||
type: 'header'
|
type: 'header'
|
||||||
el: $.el 'span',
|
el: $.el 'span',
|
||||||
textContent: 'Index Navigation'
|
textContent: 'Index Navigation'
|
||||||
order: 90
|
order: 90
|
||||||
subEntries: [modeEntry, sortEntry, repliesEntry]
|
subEntries: [modeEntry, sortEntry, repliesEntry, anchorEntry]
|
||||||
|
|
||||||
$.addClass doc, 'index-loading'
|
$.addClass doc, 'index-loading'
|
||||||
@update()
|
@update()
|
||||||
@ -318,12 +326,17 @@ Index =
|
|||||||
Index.sortedNodes.push Index.nodes[i], Index.nodes[i + 1]
|
Index.sortedNodes.push Index.nodes[i], Index.nodes[i + 1]
|
||||||
if Index.isSearching
|
if Index.isSearching
|
||||||
Index.sortedNodes = Index.querySearch(Index.searchInput.value) or Index.sortedNodes
|
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
|
offset = 0
|
||||||
for threadRoot, i in Index.sortedNodes by 2 when Get.threadFromRoot(threadRoot).isSticky
|
for threadRoot, i in Index.sortedNodes by 2 when Get.threadFromRoot(threadRoot).isSticky
|
||||||
Index.sortedNodes.splice offset++ * 2, 0, Index.sortedNodes.splice(i, 2)...
|
Index.sortedNodes.splice offset++ * 2, 0, Index.sortedNodes.splice(i, 2)...
|
||||||
return unless Conf['Filter']
|
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.
|
# while keeping the original order they appear in.
|
||||||
offset = 0
|
offset = 0
|
||||||
for threadRoot, i in Index.sortedNodes by 2 when Get.threadFromRoot(threadRoot).isOnTop
|
for threadRoot, i in Index.sortedNodes by 2 when Get.threadFromRoot(threadRoot).isOnTop
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user