diff --git a/src/General/Index.coffee b/src/General/Index.coffee index d82131355..6653472ef 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -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 diff --git a/src/General/html/Features/Index-navlinks.html b/src/General/html/Features/Index-navlinks.html index 6979ed9e8..e1f921fe6 100644 --- a/src/General/html/Features/Index-navlinks.html +++ b/src/General/html/Features/Index-navlinks.html @@ -4,4 +4,4 @@ × - +