add bottom navlinks for JSON navigation

This commit is contained in:
ccd0 2014-05-16 16:33:42 -07:00
parent 1122342917
commit 1759951e8d
4 changed files with 23 additions and 12 deletions

View File

@ -71,18 +71,20 @@ Index =
@navLinks = $.el 'div', @navLinks = $.el 'div',
className: 'navLinks' className: 'navLinks'
innerHTML: <%= importHTML('Features/Index-navlinks') %> innerHTML: <%= importHTML('Features/Index-navlinks') %>
@navLinksBot = $.el 'div',
className: 'navLinks navLinksBot'
innerHTML: <%= importHTML('Features/Index-navlinksbot') %>
@searchInput = $ '#index-search', @navLinks @searchInput = $ '#index-search', @navLinks
@currentPage = @getCurrentPage() @currentPage = @getCurrentPage()
returnlink = $ '#returnlink a', @navLinks Index.setNavLinks()
returnlink.href = "/#{g.BOARD}/"
$.on d, 'scroll', Index.scroll $.on d, 'scroll', Index.scroll
$.on @pagelist, 'click', @cb.pageNav $.on @pagelist, 'click', @cb.pageNav
$.on @searchInput, 'input', @onSearchInput $.on @searchInput, 'input', @onSearchInput
$.on $('#index-search-clear', @navLinks), 'click', @clearSearch $.on $('#index-search-clear', @navLinks), 'click', @clearSearch
$.on returnlink, 'click', Navigate.navigate $.on $('.returnlink a', @navLinks), 'click', Navigate.navigate
$.on $('#cataloglink a', @navLinks), 'click', -> window.location = "//boards.4chan.org/#{g.BOARD}/catalog" $.on $('.returnlink a', @navLinksBot), 'click', Navigate.navigate
@update() if g.VIEW is 'index' @update() if g.VIEW is 'index'
$.asap (-> $('.board', doc) or d.readyState isnt 'loading'), -> $.asap (-> $('.board', doc) or d.readyState isnt 'loading'), ->
@ -101,8 +103,11 @@ Index =
$.rm el for el in $$ '.navLinks, .navLinksBot + hr' $.rm el for el in $$ '.navLinks, .navLinksBot + hr'
$.id('search-box')?.parentNode.remove() $.id('search-box')?.parentNode.remove()
topNavPos = $.id('delform').previousElementSibling topNavPos = $.id('delform').previousElementSibling
$.before topNavPos, ($.el 'hr', className: 'desktop') if g.VIEW is 'index' botNavPos = $ '.board'
$.before topNavPos, $.el 'hr' if g.VIEW is 'index'
$.before topNavPos, Index.navLinks $.before topNavPos, Index.navLinks
$.after botNavPos, $.el 'hr'
$.after botNavPos, Index.navLinksBot
$.rmClass doc, 'index-loading' $.rmClass doc, 'index-loading'
$.asap (-> $('.pagelist', doc) or d.readyState isnt 'loading'), -> $.asap (-> $('.pagelist', doc) or d.readyState isnt 'loading'), ->
@ -111,6 +116,10 @@ Index =
else else
$.after $.id('delform'), Index.pagelist $.after $.id('delform'), Index.pagelist
setNavLinks: () ->
$('.returnlink a', Index.navLinks).href = $('.returnlink a', Index.navLinksBot).href = "//boards.4chan.org/#{g.BOARD}/"
$('.cataloglink a', Index.navLinks).href = $('.cataloglink a', Index.navLinksBot).href = "//boards.4chan.org/#{g.BOARD}/catalog"
scroll: $.debounce 100, -> scroll: $.debounce 100, ->
return if Index.req or Conf['Index Mode'] isnt 'infinite' or (doc.scrollTop <= doc.scrollHeight - (300 + window.innerHeight)) or g.VIEW is 'thread' return if Index.req or Conf['Index Mode'] isnt 'infinite' or (doc.scrollTop <= doc.scrollHeight - (300 + window.innerHeight)) or g.VIEW is 'thread'
Index.pageNum = Index.getCurrentPage() unless Index.pageNum? # Avoid having to pushState to keep track of the current page Index.pageNum = Index.getCurrentPage() unless Index.pageNum? # Avoid having to pushState to keep track of the current page

View File

@ -131,7 +131,7 @@ Navigate =
$.addClass current, 'current' if current = $ "a[href*='/#{boardID}/']", fullBoardList $.addClass current, 'current' if current = $ "a[href*='/#{boardID}/']", fullBoardList
Header.generateBoardList Conf['boardnav'].replace /(\r\n|\n|\r)/g, ' ' Header.generateBoardList Conf['boardnav'].replace /(\r\n|\n|\r)/g, ' '
$('#returnlink a').href = "/#{g.BOARD}/" Index.setNavLinks()
$('form[name="post"]').action = "//sys.4chan.org/#{g.BOARD}/post" $('form[name="post"]').action = "//sys.4chan.org/#{g.BOARD}/post"
QR.flagsInput() if Conf['Quick Reply'] QR.flagsInput() if Conf['Quick Reply']

View File

@ -498,8 +498,10 @@ div.center:not(.ad-cnt) {
.summary { .summary {
text-decoration: none; text-decoration: none;
} }
.index #returnlink, .index .returnlink,
.index #bottomlink, .index .bottomlink,
.index .navLinksBot,
.index .navLinksBot + hr,
.thread #index-last-refresh, .thread #index-last-refresh,
.thread #index-search-clear, .thread #index-search-clear,
.thread #index-search { .thread #index-search {

View File

@ -1,6 +1,6 @@
<span class=brackets-wrap id=returnlink><a href=javascript:;>Return</a></span> <span class="brackets-wrap returnlink"><a href="javascript:;">Return</a></span>
<span class=brackets-wrap id=cataloglink><a href=javascript:;>Catalog</a></span> <span class="brackets-wrap cataloglink"><a href="javascript:;">Catalog</a></span>
<span class=brackets-wrap id=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>
<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>