Move Catalog Links into the Header Menu.

This commit is contained in:
Zixaphir 2013-04-21 21:31:52 -07:00
parent 29b1f20387
commit 4d25b6ff3a
7 changed files with 66 additions and 50 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -194,6 +194,10 @@ a[href="javascript:;"] {
.expand-all-shortcut { .expand-all-shortcut {
opacity: .45; opacity: .45;
} }
#settings-container {
float: right;
}
#navbotright,
#navtopright { #navtopright {
display: none; display: none;
} }

View File

@ -1,15 +1,19 @@
CatalogLinks = CatalogLinks =
init: -> init: ->
return unless Conf['Catalog Links'] return unless Conf['Catalog Links']
el = $.el 'a', el = $.el 'label',
id: 'toggleCatalog' id: 'toggleCatalog'
href: 'javascript:;' href: 'javascript:;'
className: if Conf['Header catalog links'] then 'disabled' else '' innerHTML: "<input type=checkbox #{if Conf['Header catalog links'] then 'checked' else ''}>Catalog"
textContent: 'Catalog'
title: "Turn catalog links #{if Conf['Header catalog links'] then 'off' else 'on'}." title: "Turn catalog links #{if Conf['Header catalog links'] then 'off' else 'on'}."
$.on el, 'click', @toggle
Header.addShortcut el input = $ 'input', el
$.on input, 'change', @toggle
$.event 'AddMenuEntry',
type: 'header'
el: el
order: 95
$.asap (-> d.body), -> $.asap (-> d.body), ->
return unless Main.isThisPageLegit() return unless Main.isThisPageLegit()
@ -20,8 +24,7 @@ CatalogLinks =
CatalogLinks.toggle.call el CatalogLinks.toggle.call el
toggle: -> toggle: ->
$.set 'Header catalog links', useCatalog = @className is 'disabled' $.set 'Header catalog links', useCatalog = @checked
$.toggleClass @, 'disabled'
for a in $$ 'a', $.id('boardNavDesktop') for a in $$ 'a', $.id('boardNavDesktop')
board = a.pathname.split('/')[1] board = a.pathname.split('/')[1]
continue if ['f', 'status', '4chan'].contains(board) or !board continue if ['f', 'status', '4chan'].contains(board) or !board
@ -33,7 +36,7 @@ CatalogLinks =
else else
a.pathname = "/#{board}/#{if useCatalog then 'catalog' else ''}" a.pathname = "/#{board}/#{if useCatalog then 'catalog' else ''}"
a.title = if useCatalog then "#{a.title} - Catalog" else a.title.replace(/\ -\ Catalog$/, '') a.title = if useCatalog then "#{a.title} - Catalog" else a.title.replace(/\ -\ Catalog$/, '')
@title = "Turn catalog links #{if useCatalog then 'off' else 'on'}." @title = "Turn catalog links #{if useCatalog then 'off' else 'on'}."
external: (board) -> external: (board) ->
return ( return (

View File

@ -57,7 +57,7 @@ Header =
id: 'toggle-header-bar' id: 'toggle-header-bar'
settings: $.el 'div', settings: $.el 'div',
id: 'settingsContainer' id: 'settings-container'
createSubEntry: (setting)-> createSubEntry: (setting)->
label = $.el 'label', label = $.el 'label',
@ -88,6 +88,7 @@ Header =
fullBoardList.hidden = true fullBoardList.hidden = true
customBoardList = $.el 'span', customBoardList = $.el 'span',
id: 'custom-board-list' id: 'custom-board-list'
$.before fullBoardList, customBoardList
Header.generateBoardList Conf['boardnav'] Header.generateBoardList Conf['boardnav']
$.sync 'boardnav', Header.generateBoardList $.sync 'boardnav', Header.generateBoardList
@ -98,7 +99,6 @@ Header =
$.on btn, 'click', Header.toggleBoardList $.on btn, 'click', Header.toggleBoardList
$.prepend fullBoardList, btn $.prepend fullBoardList, btn
$.before fullBoardList, customBoardList
else else
fullBoardList.hidden = false fullBoardList.hidden = false

View File

@ -3,7 +3,7 @@ Settings =
# 4chan X settings link # 4chan X settings link
link = $.el 'a', link = $.el 'a',
className: 'settings-link' className: 'settings-link'
textContent: '<%= meta.name %> Settings' textContent: 'Settings'
href: 'javascript:;' href: 'javascript:;'
$.on link, 'click', Settings.open $.on link, 'click', Settings.open