Use a sub-entry instead of a <select> for the index mode switcher.

This commit is contained in:
Mayhem 2013-10-30 03:42:49 +01:00
parent 6918d67d5d
commit 43567173fc

View File

@ -2,25 +2,27 @@ Index =
init: -> init: ->
return if g.VIEW isnt 'index' return if g.VIEW isnt 'index'
label = $.el 'label', subEntries = []
innerHTML: """
<select name='Index Mode' title='Change the index view mode.'> subEntry =
<option disabled>Index Mode</option> el: $.el 'span', textContent: 'Index Mode'
<option value='paged'>Paged</option> subEntries: [
<option value='all pages'>All threads</option> { el: $.el 'label', innerHTML: '<input type=radio name="Index Mode" value="paged"> Paged' }
<select> { el: $.el 'label', innerHTML: '<input type=radio name="Index Mode" value="all pages"> All threads' }
""" ]
select = label.firstChild for label in subEntry.subEntries
select.value = Conf['Index Mode'] input = label.el.firstChild
$.on select, 'change', $.cb.value input.checked = Conf['Index Mode'] is input.value
$.on select, 'change', @update $.on input, 'change', $.cb.value
$.on input, 'change', @update
subEntries.push subEntry
$.event 'AddMenuEntry', $.event 'AddMenuEntry',
type: 'header' type: 'header'
el: $.el 'span', el: $.el 'span',
textContent: 'Index Navigation' textContent: 'Index Navigation'
order: 90 order: 90
subEntries: [el: label] subEntries: subEntries
$.on d, '4chanXInitFinished', @initReady $.on d, '4chanXInitFinished', @initReady