Move index mode to <select> in navlinks line.
This commit is contained in:
parent
03cb7b732e
commit
dc0cc65fd3
@ -23,23 +23,6 @@ Index =
|
|||||||
$.on @button, 'click', -> Index.update()
|
$.on @button, 'click', -> Index.update()
|
||||||
Header.addShortcut @button, 1
|
Header.addShortcut @button, 1
|
||||||
|
|
||||||
modeEntry =
|
|
||||||
el: $.el 'span', textContent: 'Index mode'
|
|
||||||
subEntries: [
|
|
||||||
{ el: $.el 'label', <%= html('<input type="radio" name="Index Mode" value="paged"> Paged') %> }
|
|
||||||
{ el: $.el 'label', <%= html('<input type="radio" name="Index Mode" value="infinite"> Infinite scrolling') %> }
|
|
||||||
{ el: $.el 'label', <%= html('<input type="radio" name="Index Mode" value="all pages"> All threads') %> }
|
|
||||||
{ el: $.el 'label', <%= html('<input type="radio" name="Index Mode" value="catalog"> Catalog') %> }
|
|
||||||
]
|
|
||||||
open: ->
|
|
||||||
for label in @subEntries
|
|
||||||
input = label.el.firstChild
|
|
||||||
input.checked = Conf['Index Mode'] is input.value
|
|
||||||
true
|
|
||||||
for label in modeEntry.subEntries
|
|
||||||
input = label.el.firstChild
|
|
||||||
$.on input, 'change', @cb.mode
|
|
||||||
|
|
||||||
repliesEntry = el: UI.checkbox 'Show Replies', ' Show replies'
|
repliesEntry = el: UI.checkbox 'Show Replies', ' Show replies'
|
||||||
anchorEntry = el: UI.checkbox 'Anchor Hidden Threads', ' Anchor hidden threads'
|
anchorEntry = el: UI.checkbox 'Anchor Hidden Threads', ' Anchor hidden threads'
|
||||||
refNavEntry = el: UI.checkbox 'Refreshed Navigation', ' Refreshed navigation'
|
refNavEntry = el: UI.checkbox 'Refreshed Navigation', ' Refreshed navigation'
|
||||||
@ -59,7 +42,7 @@ Index =
|
|||||||
el: $.el 'span',
|
el: $.el 'span',
|
||||||
textContent: 'Index Navigation'
|
textContent: 'Index Navigation'
|
||||||
order: 98
|
order: 98
|
||||||
subEntries: [repliesEntry, anchorEntry, refNavEntry, modeEntry]
|
subEntries: [repliesEntry, anchorEntry, refNavEntry]
|
||||||
|
|
||||||
$.addClass doc, 'index-loading', "#{Conf['Index Mode'].replace /\ /g, '-'}-mode"
|
$.addClass doc, 'index-loading', "#{Conf['Index Mode'].replace /\ /g, '-'}-mode"
|
||||||
@root = $.el 'div', className: 'board'
|
@root = $.el 'div', className: 'board'
|
||||||
@ -73,6 +56,7 @@ Index =
|
|||||||
$('.cataloglink a', @navLinks).href = CatalogLinks.catalog()
|
$('.cataloglink a', @navLinks).href = CatalogLinks.catalog()
|
||||||
@searchInput = $ '#index-search', @navLinks
|
@searchInput = $ '#index-search', @navLinks
|
||||||
@hideLabel = $ '#hidden-label', @navLinks
|
@hideLabel = $ '#hidden-label', @navLinks
|
||||||
|
@selectMode = $ '#index-mode', @navLinks
|
||||||
@selectSort = $ '#index-sort', @navLinks
|
@selectSort = $ '#index-sort', @navLinks
|
||||||
@selectSize = $ '#index-size', @navLinks
|
@selectSize = $ '#index-size', @navLinks
|
||||||
@currentPage = @getCurrentPage()
|
@currentPage = @getCurrentPage()
|
||||||
@ -84,7 +68,8 @@ Index =
|
|||||||
$.on $('#index-search-clear', @navLinks), 'click', @clearSearch
|
$.on $('#index-search-clear', @navLinks), 'click', @clearSearch
|
||||||
$.on $('#hidden-toggle a', @navLinks), 'click', @cb.toggleHiddenThreads
|
$.on $('#hidden-toggle a', @navLinks), 'click', @cb.toggleHiddenThreads
|
||||||
$.on $('.returnlink a', @navLinks), 'click', @cb.frontPage unless Conf['Use 4chan X Catalog']
|
$.on $('.returnlink a', @navLinks), 'click', @cb.frontPage unless Conf['Use 4chan X Catalog']
|
||||||
for select in [@selectSort, @selectSize]
|
$.on @selectMode, 'change', @cb.mode
|
||||||
|
for select in [@selectMode, @selectSort, @selectSize]
|
||||||
select.value = Conf[select.name]
|
select.value = Conf[select.name]
|
||||||
$.on select, 'change', $.cb.value
|
$.on select, 'change', $.cb.value
|
||||||
$.on @selectSort, 'change', @cb.sort
|
$.on @selectSort, 'change', @cb.sort
|
||||||
@ -198,15 +183,13 @@ Index =
|
|||||||
Index.buildIndex()
|
Index.buildIndex()
|
||||||
mode: ->
|
mode: ->
|
||||||
mode = @value
|
mode = @value
|
||||||
$.set 'Index Mode', mode
|
|
||||||
unless mode is 'catalog'
|
unless mode is 'catalog'
|
||||||
Conf['Previous Index Mode'] = mode
|
Conf['Previous Index Mode'] = mode
|
||||||
$.set 'Previous Index Mode', mode
|
$.set 'Previous Index Mode', mode
|
||||||
state = Index.pushState {mode}
|
Index.pushState {mode}
|
||||||
if state.mode
|
Index.applyMode()
|
||||||
Index.applyMode()
|
Index.buildIndex()
|
||||||
Index.buildIndex()
|
Index.setPage()
|
||||||
Index.setPage()
|
|
||||||
sort: ->
|
sort: ->
|
||||||
Index.sort()
|
Index.sort()
|
||||||
Index.buildIndex()
|
Index.buildIndex()
|
||||||
@ -308,6 +291,7 @@ Index =
|
|||||||
applyMode: ->
|
applyMode: ->
|
||||||
for mode in ['paged', 'infinite', 'all pages', 'catalog']
|
for mode in ['paged', 'infinite', 'all pages', 'catalog']
|
||||||
$[if mode is Conf['Index Mode'] then 'addClass' else 'rmClass'] doc, "#{mode.replace /\ /g, '-'}-mode"
|
$[if mode is Conf['Index Mode'] then 'addClass' else 'rmClass'] doc, "#{mode.replace /\ /g, '-'}-mode"
|
||||||
|
Index.selectMode.value = Conf['Index Mode']
|
||||||
Index.cb.size()
|
Index.cb.size()
|
||||||
Index.showHiddenThreads = false
|
Index.showHiddenThreads = false
|
||||||
$('#hidden-toggle a', Index.navLinks).textContent = 'Show'
|
$('#hidden-toggle a', Index.navLinks).textContent = 'Show'
|
||||||
|
|||||||
@ -516,7 +516,7 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) {
|
|||||||
#index-search:not([data-searching]) + #index-search-clear {
|
#index-search:not([data-searching]) + #index-search-clear {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#index-sort, #index-size {
|
#index-mode, #index-sort, #index-size {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
.summary {
|
.summary {
|
||||||
|
|||||||
@ -5,6 +5,13 @@
|
|||||||
<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 id="hidden-toggle">[<a href="javascript:;">Show</a>]</span></span>
|
<span id="hidden-label" hidden> — <span id="hidden-count"></span> <span id="hidden-toggle">[<a href="javascript:;">Show</a>]</span></span>
|
||||||
|
<select id="index-mode" name="Index Mode">
|
||||||
|
<option disabled>Index Mode</option>
|
||||||
|
<option value="paged">Paged</option>
|
||||||
|
<option value="infinite">Infinite scrolling</option>
|
||||||
|
<option value="all pages">All threads</option>
|
||||||
|
<option value="catalog">Catalog</option>
|
||||||
|
</select>
|
||||||
<select id="index-sort" name="Index Sort">
|
<select id="index-sort" name="Index Sort">
|
||||||
<option disabled>Index Sort</option>
|
<option disabled>Index Sort</option>
|
||||||
<option value="bump">Bump order</option>
|
<option value="bump">Bump order</option>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user