Make the hidden label an integral part of the index.
This commit is contained in:
parent
aeb1147bb3
commit
b9e8ff0b19
@ -2,3 +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>
|
||||||
|
|||||||
@ -157,7 +157,7 @@ ThreadHiding =
|
|||||||
return if thread.isHidden
|
return if thread.isHidden
|
||||||
threadRoot = thread.OP.nodes.root.parentNode
|
threadRoot = thread.OP.nodes.root.parentNode
|
||||||
thread.isHidden = true
|
thread.isHidden = true
|
||||||
Index.updateHideToggle()
|
Index.updateHideLabel()
|
||||||
|
|
||||||
unless makeStub
|
unless makeStub
|
||||||
threadRoot.hidden = threadRoot.nextElementSibling.hidden = true # <hr>
|
threadRoot.hidden = threadRoot.nextElementSibling.hidden = true # <hr>
|
||||||
@ -172,4 +172,4 @@ ThreadHiding =
|
|||||||
threadRoot = thread.OP.nodes.root.parentNode
|
threadRoot = thread.OP.nodes.root.parentNode
|
||||||
threadRoot.nextElementSibling.hidden =
|
threadRoot.nextElementSibling.hidden =
|
||||||
threadRoot.hidden = thread.isHidden = false
|
threadRoot.hidden = thread.isHidden = false
|
||||||
Index.updateHideToggle()
|
Index.updateHideLabel()
|
||||||
|
|||||||
@ -96,6 +96,7 @@ Index =
|
|||||||
className: 'navLinks'
|
className: 'navLinks'
|
||||||
innerHTML: <%= importHTML('General/Index-navlinks') %>
|
innerHTML: <%= importHTML('General/Index-navlinks') %>
|
||||||
@searchInput = $ '#index-search', @navLinks
|
@searchInput = $ '#index-search', @navLinks
|
||||||
|
@hideLabel = $ '#hidden-label', @navLinks
|
||||||
@currentPage = @getCurrentPage()
|
@currentPage = @getCurrentPage()
|
||||||
$.on window, 'popstate', @cb.popstate
|
$.on window, 'popstate', @cb.popstate
|
||||||
$.on @pagelist, 'click', @cb.pageNav
|
$.on @pagelist, 'click', @cb.pageNav
|
||||||
@ -249,28 +250,18 @@ Index =
|
|||||||
$.before a, strong
|
$.before a, strong
|
||||||
$.add strong, a
|
$.add strong, a
|
||||||
|
|
||||||
updateHideToggle: ->
|
updateHideLabel: ->
|
||||||
hiddenCount = 0
|
hiddenCount = 0
|
||||||
for threadID, thread of g.BOARD.threads when thread.isHidden
|
for threadID, thread of g.BOARD.threads when thread.isHidden
|
||||||
hiddenCount++ if thread.ID in Index.liveThreadIDs
|
hiddenCount++ if thread.ID in Index.liveThreadIDs
|
||||||
unless hiddenCount
|
unless hiddenCount
|
||||||
Index.removeHideToggle()
|
Index.hideLabel.hidden = true
|
||||||
return
|
return
|
||||||
unless Index.toggler
|
Index.hideLabel.hidden = false
|
||||||
Index.addHideToggle()
|
|
||||||
$('#hidden-count', Index.navLinks).textContent = if hiddenCount is 1
|
$('#hidden-count', Index.navLinks).textContent = if hiddenCount is 1
|
||||||
'1 hidden thread'
|
'1 hidden thread'
|
||||||
else
|
else
|
||||||
"#{hiddenCount} hidden threads"
|
"#{hiddenCount} hidden threads"
|
||||||
addHideToggle: ->
|
|
||||||
Index.toggler = $.el 'span',
|
|
||||||
id: 'hidden-label'
|
|
||||||
innerHTML: ' — <span id="hidden-count"></span>'
|
|
||||||
$.add Index.navLinks, Index.toggler
|
|
||||||
removeHideToggle: ->
|
|
||||||
return unless Index.toggler
|
|
||||||
$.rm Index.toggler
|
|
||||||
delete Index.toggler
|
|
||||||
|
|
||||||
update: (pageNum) ->
|
update: (pageNum) ->
|
||||||
return unless navigator.onLine
|
return unless navigator.onLine
|
||||||
@ -390,7 +381,7 @@ Index =
|
|||||||
$.nodes Index.nodes
|
$.nodes Index.nodes
|
||||||
Main.callbackNodes Thread, threads
|
Main.callbackNodes Thread, threads
|
||||||
Main.callbackNodes Post, posts
|
Main.callbackNodes Post, posts
|
||||||
Index.updateHideToggle()
|
Index.updateHideLabel()
|
||||||
$.event 'IndexRefresh'
|
$.event 'IndexRefresh'
|
||||||
buildReplies: (threadRoots) ->
|
buildReplies: (threadRoots) ->
|
||||||
posts = []
|
posts = []
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user