Add a show/hide hidden threads toggle for the catalog mode.

Conflicts:
	html/General/Index-navlinks.html
	src/General/Index.coffee
This commit is contained in:
Mayhem 2014-02-01 21:16:17 +01:00 committed by ccd0
parent b8bd58ceb8
commit 95cf0e04fd
2 changed files with 19 additions and 6 deletions

View File

@ -72,7 +72,6 @@ Index =
$.addClass doc, 'index-loading'
@root = $.el 'div', className: 'board'
Index.cb.rootClass()
@pagelist = $.el 'div',
className: 'pagelist'
hidden: true
@ -91,6 +90,8 @@ Index =
$.on @pagelist, 'click', @cb.pageNav
$.on @searchInput, 'input', @onSearchInput
$.on $('#index-search-clear', @navLinks), 'click', @clearSearch
$.on $('#hidden-toggle a', @navLinks), 'click', @cb.toggleHiddenThreads
@cb.toggleCatalogMode()
@update()
$.asap (-> $('.board', doc) or d.readyState isnt 'loading'), ->
@ -174,10 +175,22 @@ Index =
Index.buildIndex()
cb:
rootClass: ->
(if Conf['Index Mode'] is 'catalog' then $.addClass else $.rmClass) Index.root, 'catalog-mode'
toggleCatalogMode: ->
if Conf['Index Mode'] is 'catalog'
$.addClass Index.root, 'catalog-mode'
$('#hidden-toggle', Index.navLinks).hidden = false
else
$.rmClass Index.root, 'catalog-mode'
$('#hidden-toggle', Index.navLinks).hidden = true
toggleHiddenThreads: ->
@textContent = if Index.showHiddenThreads = !Index.showHiddenThreads
'Hide'
else
'Show'
Index.sort()
Index.buildIndex()
mode: ->
Index.cb.rootClass()
Index.cb.toggleCatalogMode()
Index.togglePagelist()
Index.buildIndex()
sort: ->
@ -431,7 +444,7 @@ Index =
buildCatalogViews: ->
threads = Index.sortedNodes
.map((threadRoot) -> Get.threadFromRoot threadRoot)
.filter (thread) -> !thread.isHidden
.filter (thread) -> !thread.isHidden isnt Index.showHiddenThreads
catalogThreads = []
for thread in threads when !thread.catalogView
catalogThreads.push new CatalogThread Build.catalogThread(thread), thread

View File

@ -4,4 +4,4 @@
<span class="brackets-wrap" id="index-last-refresh"><time title="Last index refresh">...</time></span>
<input type="search" id="index-search" class="field" placeholder="Search">
<a id="index-search-clear" href="javascript:;" title="Clear search">×</a>
<span id="hidden-label" hidden> &mdash; <span id="hidden-count"></span></span>
<span id="hidden-label" hidden> &mdash; <span id="hidden-count"></span> <span id="hidden-toggle" hidden>[<a href="javascript:;">Show</a>]</span></span>