Try to make index navigation less confusing. Also implement index mode keybinds.

This commit is contained in:
ccd0 2015-02-09 09:21:02 -08:00
parent ae621e96ef
commit 0830d042cb
6 changed files with 34 additions and 15 deletions

View File

@ -837,6 +837,18 @@ Config =
'Ctrl+Left' 'Ctrl+Left'
'Jump to the previous page.' 'Jump to the previous page.'
] ]
'Paged mode': [
'Alt+1'
'Open the index in paged mode.'
]
'Infinite scrolling mode': [
'Alt+2'
'Open the index in infinite scrolling mode.'
]
'All pages mode': [
'Alt+3'
'Open the index in all threads mode.'
]
'Open catalog': [ 'Open catalog': [
'Shift+c' 'Shift+c'
'Open the catalog of the current board.' 'Open the catalog of the current board.'

View File

@ -57,7 +57,6 @@ Index =
$('.cataloglink a', @pagelist).href = CatalogLinks.catalog() $('.cataloglink a', @pagelist).href = CatalogLinks.catalog()
@navLinks = $.el 'div', className: 'navLinks' @navLinks = $.el 'div', className: 'navLinks'
$.extend @navLinks, <%= importHTML('Features/Index-navlinks') %> $.extend @navLinks, <%= importHTML('Features/Index-navlinks') %>
$('.returnlink a', @navLinks).href = CatalogLinks.index()
$('.cataloglink a', @navLinks).href = CatalogLinks.catalog() $('.cataloglink a', @navLinks).href = CatalogLinks.catalog()
$('.archlistlink', @navLinks).hidden = true if g.BOARD.ID is 'b' $('.archlistlink', @navLinks).hidden = true if g.BOARD.ID is 'b'
@searchInput = $ '#index-search', @navLinks @searchInput = $ '#index-search', @navLinks
@ -73,7 +72,6 @@ Index =
$.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 $.on $('#hidden-toggle a', @navLinks), 'click', @cb.toggleHiddenThreads
$.on $('.returnlink a', @navLinks), 'click', @cb.frontPage unless Conf['Use <%= meta.name %> Catalog']
$.on @selectMode, 'change', @cb.mode $.on @selectMode, 'change', @cb.mode
for select in [@selectMode, @selectSort, @selectSize] for select in [@selectMode, @selectSort, @selectSize]
select.value = Conf[select.name] select.value = Conf[select.name]
@ -263,11 +261,6 @@ Index =
e.preventDefault() e.preventDefault()
Index.userPageNav +a.pathname.split('/')[2] or 1 Index.userPageNav +a.pathname.split('/')[2] or 1
frontPage: (e) ->
return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0
e.preventDefault()
Index.userPageNav 1
scrollToIndex: -> scrollToIndex: ->
Header.scrollToIfNeeded Index.navLinks Header.scrollToIfNeeded Index.navLinks

View File

@ -545,6 +545,8 @@ div[data-checked="false"] > .suboption-list {
:root.infinite-mode .pagelist, :root.infinite-mode .pagelist,
:root.all-pages-mode .pagelist, :root.all-pages-mode .pagelist,
:root.catalog-mode .pagelist, :root.catalog-mode .pagelist,
:root:not(.catalog-mode) .indexlink,
:root.catalog-mode .cataloglink,
:root:not(.catalog-mode) #hidden-label, :root:not(.catalog-mode) #hidden-label,
:root:not(.catalog-mode) #index-size { :root:not(.catalog-mode) #index-size {
display: none; display: none;

View File

@ -1,5 +1,5 @@
<span class="brackets-wrap returnlink"><a href="./">Return</a></span> <span class="brackets-wrap indexlink"><a href="#index">Index</a></span>
<span class="brackets-wrap cataloglink"><a href="./catalog">Catalog</a></span> <span class="brackets-wrap cataloglink"><a href="#catalog">Catalog</a></span>
<span class="brackets-wrap archlistlink"><a href="./archive">Archive</a></span> <span class="brackets-wrap archlistlink"><a href="./archive">Archive</a></span>
<span class="brackets-wrap bottomlink"><a href="#bottom">Bottom</a></span> <span class="brackets-wrap bottomlink"><a href="#bottom">Bottom</a></span>
<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>

View File

@ -8,8 +8,11 @@ CatalogLinks =
$.ready -> $.ready ->
for link in $$ selector for link in $$ selector
switch link.pathname switch link.pathname
when "/#{g.BOARD}/" then link.href = CatalogLinks.index() when "/#{g.BOARD}/"
when "/#{g.BOARD}/catalog" then link.href = CatalogLinks.catalog() link.textContent = 'Index' if Conf['JSON Navigation']
link.href = CatalogLinks.index()
when "/#{g.BOARD}/catalog"
link.href = CatalogLinks.catalog()
if g.VIEW is 'catalog' and Conf['JSON Navigation'] and Conf['Use <%= meta.name %> Catalog'] if g.VIEW is 'catalog' and Conf['JSON Navigation'] and Conf['Use <%= meta.name %> Catalog']
catalogLink = link.parentNode.cloneNode true catalogLink = link.parentNode.cloneNode true
catalogLink.firstElementChild.textContent = '<%= meta.name %> Catalog' catalogLink.firstElementChild.textContent = '<%= meta.name %> Catalog'
@ -76,7 +79,7 @@ CatalogLinks =
"/#{board}/catalog" "/#{board}/catalog"
index: (board=g.BOARD.ID) -> index: (board=g.BOARD.ID) ->
if Conf['JSON Navigation'] and Conf['Use <%= meta.name %> Catalog'] if Conf['JSON Navigation']
if g.BOARD.ID is board and g.VIEW is 'index' then '#index' else "/#{board}/#index" if g.BOARD.ID is board and g.VIEW is 'index' then '#index' else "/#{board}/#index"
else else
"/#{board}/" "/#{board}/"

View File

@ -105,12 +105,12 @@ Keybinds =
FappeTyme.toggle 'werk' FappeTyme.toggle 'werk'
# Board Navigation # Board Navigation
when Conf['Front page'] when Conf['Front page']
if Conf['JSON Navigation'] and !Conf['Use <%= meta.name %> Catalog'] and g.VIEW is 'index' if Conf['JSON Navigation'] and g.VIEW is 'index'
Index.userPageNav 1 Index.userPageNav 1
else else
window.location = CatalogLinks.index() window.location = "/#{g.BOARD}/"
when Conf['Open front page'] when Conf['Open front page']
$.open CatalogLinks.index() $.open "/#{g.BOARD}/"
when Conf['Next page'] when Conf['Next page']
return unless g.VIEW is 'index' return unless g.VIEW is 'index'
if Conf['JSON Navigation'] if Conf['JSON Navigation']
@ -132,6 +132,15 @@ Keybinds =
searchInput = if Conf['JSON Navigation'] then Index.searchInput else $.id('search-box') searchInput = if Conf['JSON Navigation'] then Index.searchInput else $.id('search-box')
Header.scrollToIfNeeded searchInput Header.scrollToIfNeeded searchInput
searchInput.focus() searchInput.focus()
when Conf['Paged mode']
return unless Conf['JSON Navigation']
window.location = if g.VIEW is 'index' then '#paged' else "/#{g.BOARD}/#paged"
when Conf['Infinite scrolling mode']
return unless Conf['JSON Navigation']
window.location = if g.VIEW is 'index' then '#infinite' else "/#{g.BOARD}/#infinite"
when Conf['All pages mode']
return unless Conf['JSON Navigation']
window.location = if g.VIEW is 'index' then '#all-pages' else "/#{g.BOARD}/#all-pages"
when Conf['Open catalog'] when Conf['Open catalog']
window.location = CatalogLinks.catalog() window.location = CatalogLinks.catalog()
when Conf['Cycle sort type'] when Conf['Cycle sort type']