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 d, 'scroll', Index.scroll
$.on @pagelist, 'click', @cb.pageNav $.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' if g.VIEW is 'index'
Index.setIndexMode Conf['Previous Index Mode'] Index.setIndexMode Conf['Previous Index Mode']
e.preventDefault() e.preventDefault()
return return
Navigate.navigate.call @, e Navigate.navigate.call @, e
$.on @catalogLink, 'click', Navigate.navigate
Header.addShortcut @catalogLink, true
Header.addShortcut returnLink, true
if g.VIEW is 'index' if g.VIEW is 'index'
@update() @update()
@cb.toggleCatalogMode() @cb.toggleCatalogMode()

View File

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

View File

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

View File

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