Make the hidden label an integral part of the index.
Conflicts: html/General/Index-navlinks.html src/Filtering/ThreadHiding.coffee
This commit is contained in:
parent
d9e4dcda41
commit
b8bd58ceb8
@ -188,7 +188,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()
|
||||||
|
|
||||||
return threadRoot.hidden = true unless makeStub
|
return threadRoot.hidden = true unless makeStub
|
||||||
|
|
||||||
@ -200,4 +200,4 @@ ThreadHiding =
|
|||||||
delete thread.stub
|
delete thread.stub
|
||||||
threadRoot = thread.OP.nodes.root.parentNode
|
threadRoot = thread.OP.nodes.root.parentNode
|
||||||
threadRoot.hidden = thread.isHidden = false
|
threadRoot.hidden = thread.isHidden = false
|
||||||
Index.updateHideToggle()
|
Index.updateHideLabel()
|
||||||
|
|||||||
@ -83,6 +83,7 @@ Index =
|
|||||||
$('.returnlink a', @navLinks).href = "//boards.4chan.org/#{g.BOARD}/"
|
$('.returnlink a', @navLinks).href = "//boards.4chan.org/#{g.BOARD}/"
|
||||||
$('.cataloglink a', @navLinks).href = "//boards.4chan.org/#{g.BOARD}/catalog"
|
$('.cataloglink a', @navLinks).href = "//boards.4chan.org/#{g.BOARD}/catalog"
|
||||||
@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
|
||||||
|
|
||||||
@ -267,28 +268,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, forceReparse) ->
|
update: (pageNum, forceReparse) ->
|
||||||
return unless navigator.onLine
|
return unless navigator.onLine
|
||||||
@ -409,7 +400,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) ->
|
||||||
|
|||||||
@ -4,3 +4,4 @@
|
|||||||
<span class="brackets-wrap" id="index-last-refresh"><time title="Last index refresh">...</time></span>
|
<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">
|
<input type="search" id="index-search" class="field" placeholder="Search">
|
||||||
<a id="index-search-clear" href="javascript:;" title="Clear search">×</a>
|
<a id="index-search-clear" href="javascript:;" title="Clear search">×</a>
|
||||||
|
<span id="hidden-label" hidden> — <span id="hidden-count"></span></span>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user