Due to popular request, restore the catalog button.

This commit is contained in:
Zixaphir 2014-03-14 18:40:48 -07:00
parent 823f09634f
commit 6e03bb150e
6 changed files with 142 additions and 46 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -118,13 +118,31 @@ Index =
$.on d, 'scroll', Index.scroll
$.on @pagelist, 'click', @cb.pageNav
$.on $('#returnlink a', @navLinks), 'click', (e) ->
returnLink = $.el 'a',
id: 'returnIcon'
className: 'a-icon'
href: '.././'
@catalogLink = $.el 'a',
id: 'catalogIcon'
className: 'a-icon'
href: "//boards.4chan.org/#{g.BOARD.ID}/"
@catalogLink.dataset.indexMode = 'catalog'
$.on returnLink, 'click', (e) ->
if g.VIEW is 'index'
Index.setIndexMode Conf['Previous Index Mode']
e.preventDefault()
return
Navigate.navigate.call @, e
$.on @catalogLink, 'click', Navigate.navigate
Header.addShortcut @catalogLink, true
Header.addShortcut returnLink, true
if g.VIEW is 'index'
@update()
@cb.toggleCatalogMode()

View File

@ -118,6 +118,7 @@ Navigate =
$.rmClass $('.current', fullBoardList), 'current'
$.addClass $("a[href*='/#{boardID}/']", fullBoardList), 'current'
Header.generateBoardList Conf['boardnav'].replace /(\r\n|\n|\r)/g, ' '
Index.catalogLink.href = "//boards.4chan.org/#{boardID}/"
QR.flagsInput()
@ -163,18 +164,37 @@ Navigate =
$.rm subtitle if subtitle = $ '.boardSubtitle'
$('.boardTitle').textContent = d.title = "/#{board}/ - #{title}"
setMode: (a) ->
{indexMode, indexSort} = a.dataset
result = false
if indexMode and Conf['Index Mode'] isnt indexMode
$.set 'Index Mode', Conf['Index Mode'] = Index.selectMode.value = indexMode
Index.cb.mode()
result = true
if indexSort and Conf['Index Sort'] isnt indexSort
$.set 'Index Sort', Conf['Index Sort'] = Index.selectSort.value = indexSort
Index.cb.sort()
result = true
return result
navigate: (e) ->
return if @hostname isnt 'boards.4chan.org' or window.location.hostname is 'rs.4chan.org'
if e
if e.shiftKey or e.ctrlKey or (e.type is 'click' and e.button isnt 0) # Not simply a left click
return
Navigate.setMode @ unless e?.button is 2 # Right Click
return
if @pathname is Navigate.path
if g.VIEW is 'thread'
ThreadUpdater.update()
else
unless Index.searchTest()
Index.update()
if Navigate.setMode @
Index.buildIndex()
else
Index.update()
e.preventDefault()
return
@ -203,15 +223,8 @@ Navigate =
history.pushState null, '', path unless @id is 'popState'
Navigate.path = @pathname
{indexMode, indexSort} = @dataset
if indexMode and Conf['Index Mode'] isnt indexMode
$.set 'Index Mode', Conf['Index Mode'] = Index.selectMode.value = indexMode
Index.cb.mode()
if indexSort and Conf['Index Sort'] isnt indexSort
$.set 'Index Sort', Conf['Index Sort'] = Index.selectSort.value = indexSort
Index.cb.sort()
Navigate.setMode @
unless view is 'index' and 'index' is g.VIEW and boardID is g.BOARD.ID
Navigate.disconnect()

View File

@ -89,7 +89,8 @@ body > hr {
}
:root:not(.catalog-mode) #index-size,
:root:not(.catalog-mode) #index-size + .selectrice,
.index:not(.catalog-mode) #returnlink {
.index:not(.catalog-mode) #returnIcon,
.index.catalog-mode #catalogIcon {
display: none;
}
#index-menu .selectrice {
@ -599,6 +600,9 @@ nav a,
#navNext {
<%= order %>: 80;
}
#catalogIcon {
<%= order %>: 90;
}
#returnIcon {
<%= order %>: 100;
}
@ -668,6 +672,9 @@ nav a,
#img-controls {
background-position: 0 -90px;
}
#catalogIcon {
background-position: 0 -120px;
}
#fappeTyme {
background-position: 0 -135px;
}

View File

@ -25,6 +25,4 @@
<option value="small">Small</option>
<option value="large">Large</option>
</select>
</span>
<span class=brackets-wrap id=returnlink><a href=.././>Return</a></span>
<span class=brackets-wrap id=bottomlink><a href="#bottom">Bottom</a></span>
</span>