Better treatment of bottom board list. #291

Should fix conflict with native catalog.
This commit is contained in:
ccd0 2015-01-13 18:52:32 -08:00
parent 228bfe2b54
commit 81b03063cf
3 changed files with 17 additions and 10 deletions

View File

@ -44,6 +44,7 @@ Header =
@setBarVisibility Conf['Header auto-hide'] @setBarVisibility Conf['Header auto-hide']
@setLinkJustify Conf['Centered links'] @setLinkJustify Conf['Centered links']
@setShortcutIcons Conf['Shortcut Icons'] @setShortcutIcons Conf['Shortcut Icons']
@setFooterVisibility Conf['Bottom Board List']
$.sync 'Fixed Header', @setBarFixed $.sync 'Fixed Header', @setBarFixed
$.sync 'Header auto-hide on scroll', @setHideBarOnScroll $.sync 'Header auto-hide on scroll', @setHideBarOnScroll
@ -51,6 +52,7 @@ Header =
$.sync 'Shortcut Icons', @setShortcutIcons $.sync 'Shortcut Icons', @setShortcutIcons
$.sync 'Header auto-hide', @setBarVisibility $.sync 'Header auto-hide', @setBarVisibility
$.sync 'Centered links', @setLinkJustify $.sync 'Centered links', @setLinkJustify
$.sync 'Bottom Board List', @setFooterVisibility
@addShortcut menuButton @addShortcut menuButton
@ -86,17 +88,19 @@ Header =
# Wait for #boardNavMobile instead of #boardNavDesktop, # Wait for #boardNavMobile instead of #boardNavDesktop,
# it might be incomplete otherwise. # it might be incomplete otherwise.
$.asap (-> $.id('boardNavMobile') or d.readyState isnt 'loading'), -> $.asap (-> $.id('boardNavMobile') or d.readyState isnt 'loading'), ->
Header.footer = footer = $.id('boardNavDesktop').cloneNode true footer = $.id('boardNavDesktop').cloneNode true
footer.id = 'boardNavDesktopFoot' footer.id = 'boardNavDesktopFoot'
$.rm $('#navtopright', footer) $('#navtopright', footer).id = 'navbotright'
$('#settingsWindowLink', footer).id = 'settingsWindowLinkBot'
Header.bottomBoardList = $ '.boardList', footer
if a = $ "a[href*='/#{g.BOARD}/']", footer if a = $ "a[href*='/#{g.BOARD}/']", footer
a.className = 'current' a.className = 'current'
Header.setFooterVisibility Conf['Bottom Board List']
$.sync 'Bottom Board List', Header.setFooterVisibility
Main.ready -> Main.ready ->
$.rm oldFooter if oldFooter = $.id 'boardNavDesktopFoot' if oldFooter = $.id 'boardNavDesktopFoot'
$.globalEval 'window.cloneTopNav = function() {};' $.replace $('.boardList', oldFooter), Header.bottomBoardList
$.before $.id('absbot'), footer else
$.before $.id('absbot'), footer
$.globalEval 'window.cloneTopNav = function() {};'
Header.setBoardList() Header.setBoardList()
$.prepend d.body, @bar $.prepend d.body, @bar
$.add d.body, Header.hover $.add d.body, Header.hover
@ -363,14 +367,14 @@ Header =
setFooterVisibility: (hide) -> setFooterVisibility: (hide) ->
Header.footerToggler.checked = hide Header.footerToggler.checked = hide
Header.footer.hidden = hide doc.classList.toggle 'hide-bottom-board-list', hide
toggleFooterVisibility: -> toggleFooterVisibility: ->
$.event 'CloseMenu' $.event 'CloseMenu'
hide = if @nodeName is 'INPUT' hide = if @nodeName is 'INPUT'
@checked @checked
else else
!!Header.footer.hidden $.hasClass doc, 'hide-bottom-board-list'
Header.setFooterVisibility hide Header.setFooterVisibility hide
$.set 'Bottom Board List', hide $.set 'Bottom Board List', hide
message = if hide message = if hide

View File

@ -59,6 +59,9 @@ a[href="javascript:;"] {
#boardNavDesktop, #boardNavMobile { #boardNavDesktop, #boardNavMobile {
display: none !important; display: none !important;
} }
:root.hide-bottom-board-list #boardNavDesktopFoot {
display: none;
}
body.hasDropDownNav{ body.hasDropDownNav{
margin-top: 5px; margin-top: 5px;
} }

View File

@ -53,7 +53,7 @@ CatalogLinks =
CatalogLinks.set @checked CatalogLinks.set @checked
set: (useCatalog) -> set: (useCatalog) ->
for a in $$('a:not([data-only])', Header.boardList).concat $$('a', Header.footer) for a in $$('a:not([data-only])', Header.boardList).concat $$('a', Header.bottomBoardList)
continue if a.hostname not in ['boards.4chan.org', 'catalog.neet.tv', '4index.gropes.us'] or continue if a.hostname not in ['boards.4chan.org', 'catalog.neet.tv', '4index.gropes.us'] or
!(board = a.pathname.split('/')[1]) or !(board = a.pathname.split('/')[1]) or
board in ['f', 'status', '4chan'] or board in ['f', 'status', '4chan'] or