Imma take a chance to make our toggles better.

This commit is contained in:
Zixaphir 2013-03-16 15:29:45 -07:00
parent 66e44097f7
commit 56313213d1
4 changed files with 35 additions and 29 deletions

File diff suppressed because one or more lines are too long

View File

@ -148,8 +148,9 @@ a[href="javascript:;"] {
.brackets-wrap::after {
content: "]\\00a0";
}
.disabled,
.expand-all-shortcut {
opacity: .35;
opacity: .45;
}
/* Notifications */

View File

@ -122,7 +122,9 @@ CatalogLinks =
el = $.el 'a',
id: 'toggleCatalog'
href: 'javascript:;'
textContent: 'Catalog Off'
className: if Conf['Header catalog links'] then 'disabled' else ''
textContent: 'Catalog'
title: "Turn catalog links #{if Conf['Header catalog links'] then 'off' else 'on'}."
$.on el, 'click', @toggle
Header.addShortcut el
@ -133,13 +135,11 @@ CatalogLinks =
# it might be incomplete otherwise.
$.asap (-> $.id 'boardNavMobile'), ->
# Set links on load.
CatalogLinks.toggle.call el, true
CatalogLinks.toggle.call el
toggle: (onLoad) ->
if onLoad is true
useCatalog = $.get 'CatalogIsToggled', g.VIEW is 'catalog'
else
$.set 'CatalogIsToggled', useCatalog = @textContent is 'Catalog Off'
toggle: ->
$.set 'Header catalog links', useCatalog = @className is 'disabled'
$.toggleClass @, 'disabled'
for a in $$ 'a', $.id('boardNavDesktop')
board = a.pathname.split('/')[1]
continue if ['f', 'status', '4chan'].contains(board) or !board
@ -151,7 +151,6 @@ CatalogLinks =
else
a.pathname = "/#{board}/#{if useCatalog then 'catalog' else ''}"
a.title = if useCatalog then "#{a.title} - Catalog" else a.title.replace(/\ -\ Catalog$/, '')
@textContent = "Catalog #{if useCatalog then 'On' else 'Off'}"
@title = "Turn catalog links #{if useCatalog then 'off' else 'on'}."
external: (board) ->

View File

@ -19,15 +19,19 @@ QR =
$.addClass doc, 'hide-original-post-form'
sc = $.el 'a',
className: 'qr-shortcut'
className: "qr-shortcut #{unless Conf['Persistent QR'] then 'disabled' else ''}"
textContent: 'QR'
title: 'Quick Reply'
href: 'javascript:;'
$.on sc, 'click', ->
$.event 'CloseMenu'
QR.open()
QR.resetThreadSelector()
QR.nodes.com.focus()
if !QR.nodes or QR.nodes.el.hidden
QR.open()
QR.nodes.com.focus()
QR.resetThreadSelector()
else
QR.close()
$.toggleClass @, 'disabled'
Header.addShortcut sc
if $.engine is 'webkit'