Add Catalog Hover Toggle setting: whether clicking in the catalog toggles Catalog Hover Expand. #489

This commit is contained in:
ccd0 2016-11-12 20:57:02 -08:00
parent 9c9307bdd3
commit d40495fba8
2 changed files with 10 additions and 6 deletions

View File

@ -47,7 +47,7 @@ Index =
# Header "Index Navigation" submenu
entries = []
inputs = {}
@inputs = inputs = {}
for name, arr of Config.Index when arr instanceof Array
label = UI.checkbox name, "#{name[0]}#{name[1..].toLowerCase()}"
label.title = arr[1]
@ -70,7 +70,7 @@ Index =
sortEntry = UI.checkbox 'Per-Board Sort Type', 'Per-board sort type', (typeof Conf['Index Sort'] is 'object')
sortEntry.title = 'Set the sorting order of each board independently.'
$.on sortEntry.firstChild, 'change', @cb.perBoardSort
entries.splice 2, 0, {el: sortEntry}
entries.splice 3, 0, {el: sortEntry}
Header.menu.addEntry
el: $.el 'span',
@ -114,6 +114,7 @@ Index =
@root = $.el 'div', className: 'board json-index'
$.on @root, 'click', @cb.hoverToggle
@cb.size()
@cb.hover()
# Page list
@pagelist = $.el 'div', className: 'pagelist json-index'
@ -283,11 +284,13 @@ Index =
Index.buildIndex()
hover: ->
$.rmClass doc, 'catalog-hover-expand' unless Conf['Catalog Hover Expand']
doc.classList.toggle 'catalog-hover-expand', Conf['Catalog Hover Expand']
hoverToggle: (e) ->
if Conf['Catalog Hover Expand'] and $.hasClass(doc, 'catalog-mode') and !$.modifiedClick(e) and !$.x('ancestor-or-self::a', e.target)
$.toggleClass doc, 'catalog-hover-expand'
if Conf['Catalog Hover Toggle'] and $.hasClass(doc, 'catalog-mode') and !$.modifiedClick(e) and !$.x('ancestor-or-self::a', e.target)
input = Index.inputs['Catalog Hover Expand']
input.checked = !input.checked
$.event 'change', null, input
if (thread = Get.threadFromNode e.target)
Index.cb.catalogReplies.call thread
Index.cb.hoverAdjust.call thread.OP.nodes

View File

@ -747,7 +747,8 @@ Config =
'Previous Index Mode': 'paged'
'Index Size': 'small'
'Show Replies': [true, 'Show replies in the index, and also in the catalog if "Catalog hover expand" is checked.']
'Catalog Hover Expand': [true, 'Clicking in the catalog shows more details in the thread you are hovering over.']
'Catalog Hover Expand': [false, 'Expand the comment and show more details when you hover over a thread in the catalog.']
'Catalog Hover Toggle': [true, 'Turn "Catalog hover expand" on and off by clicking in the catalog.']
'Pin Watched Threads': [false, 'Move watched threads to the start of the index.']
'Anchor Hidden Threads': [true, 'Move hidden threads to the end of the index.']
'Refreshed Navigation': [false, 'Refresh index when navigating through pages.']