Add a show/hide hidden threads toggle for the catalog mode.
This commit is contained in:
parent
b9e8ff0b19
commit
bbaac896e5
@ -2,4 +2,4 @@
|
|||||||
[<time id="index-last-refresh" title="Last index refresh">...</time>]
|
[<time id="index-last-refresh" title="Last index refresh">...</time>]
|
||||||
<input type="search" id="index-search" class="field" placeholder="Search">
|
<input type="search" id="index-search" class="field" placeholder="Search">
|
||||||
<a id="index-search-clear" class="fa fa-times-circle" href="javascript:;"></a>
|
<a id="index-search-clear" class="fa fa-times-circle" href="javascript:;"></a>
|
||||||
<span id="hidden-label" hidden> — <span id="hidden-count"></span></span>
|
<span id="hidden-label" hidden> — <span id="hidden-count"></span> <span id="hidden-toggle" hidden>[<a href="javascript:;">Show</a>]</span></span>
|
||||||
|
|||||||
@ -87,7 +87,6 @@ Index =
|
|||||||
$.addClass doc, 'index-loading'
|
$.addClass doc, 'index-loading'
|
||||||
@update()
|
@update()
|
||||||
@root = $.el 'div', className: 'board'
|
@root = $.el 'div', className: 'board'
|
||||||
Index.cb.rootClass()
|
|
||||||
@pagelist = $.el 'div',
|
@pagelist = $.el 'div',
|
||||||
className: 'pagelist'
|
className: 'pagelist'
|
||||||
hidden: true
|
hidden: true
|
||||||
@ -102,6 +101,8 @@ Index =
|
|||||||
$.on @pagelist, 'click', @cb.pageNav
|
$.on @pagelist, 'click', @cb.pageNav
|
||||||
$.on @searchInput, 'input', @onSearchInput
|
$.on @searchInput, 'input', @onSearchInput
|
||||||
$.on $('#index-search-clear', @navLinks), 'click', @clearSearch
|
$.on $('#index-search-clear', @navLinks), 'click', @clearSearch
|
||||||
|
$.on $('#hidden-toggle a', @navLinks), 'click', @cb.toggleHiddenThreads
|
||||||
|
@cb.toggleCatalogMode()
|
||||||
$.asap (-> $('.board', doc) or d.readyState isnt 'loading'), ->
|
$.asap (-> $('.board', doc) or d.readyState isnt 'loading'), ->
|
||||||
board = $ '.board'
|
board = $ '.board'
|
||||||
$.replace board, Index.root
|
$.replace board, Index.root
|
||||||
@ -155,10 +156,22 @@ Index =
|
|||||||
Index.buildIndex()
|
Index.buildIndex()
|
||||||
|
|
||||||
cb:
|
cb:
|
||||||
rootClass: ->
|
toggleCatalogMode: ->
|
||||||
(if Conf['Index Mode'] is 'catalog' then $.addClass else $.rmClass) Index.root, 'catalog-mode'
|
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: ->
|
mode: ->
|
||||||
Index.cb.rootClass()
|
Index.cb.toggleCatalogMode()
|
||||||
Index.togglePagelist()
|
Index.togglePagelist()
|
||||||
Index.buildIndex()
|
Index.buildIndex()
|
||||||
sort: ->
|
sort: ->
|
||||||
@ -411,7 +424,7 @@ Index =
|
|||||||
threads = Index.sortedNodes
|
threads = Index.sortedNodes
|
||||||
.filter (n, i) -> !(i % 2)
|
.filter (n, i) -> !(i % 2)
|
||||||
.map (threadRoot) -> Get.threadFromRoot threadRoot
|
.map (threadRoot) -> Get.threadFromRoot threadRoot
|
||||||
.filter (thread) -> !thread.isHidden
|
.filter (thread) -> !thread.isHidden isnt Index.showHiddenThreads
|
||||||
catalogThreads = []
|
catalogThreads = []
|
||||||
for thread in threads when !thread.catalogView
|
for thread in threads when !thread.catalogView
|
||||||
catalogThreads.push new CatalogThread Build.catalogThread(thread), thread
|
catalogThreads.push new CatalogThread Build.catalogThread(thread), thread
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user