this seems to be a common pattern
This commit is contained in:
parent
75f639172b
commit
1189b71029
@ -35,12 +35,9 @@ PostHiding =
|
||||
href: 'javascript:;'
|
||||
$.on apply, 'click', PostHiding.menu.hide
|
||||
|
||||
thisPost = $.el 'label',
|
||||
innerHTML: '<input type=checkbox name=thisPost checked> This post'
|
||||
replies = $.el 'label',
|
||||
innerHTML: "<input type=checkbox name=replies #{if Conf['Recursive Hiding'] then 'checked' else ''}> Hide replies"
|
||||
makeStub = $.el 'label',
|
||||
innerHTML: "<input type=checkbox name=makeStub #{if Conf['Stubs'] then 'checked' else ''}> Make stub"
|
||||
thisPost = UI.checkbox 'thisPost', ' This post', true
|
||||
replies = UI.checkbox 'replies', ' Hide replies', Conf['Recursive Hiding']
|
||||
makeStub = UI.checkbox 'makeStub', ' Make stub', Conf['Stubs']
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
type: 'post'
|
||||
@ -71,10 +68,8 @@ PostHiding =
|
||||
href: 'javascript:;'
|
||||
$.on apply, 'click', PostHiding.menu.show
|
||||
|
||||
thisPost = $.el 'label',
|
||||
innerHTML: '<input type=checkbox name=thisPost> This post'
|
||||
replies = $.el 'label',
|
||||
innerHTML: "<input type=checkbox name=replies> Show replies"
|
||||
thisPost = UI.checkbox 'thisPost', ' This post', false
|
||||
replies = UI.checkbox 'replies', ' Show replies', false
|
||||
hideStubLink = $.el 'a',
|
||||
textContent: 'Hide stub'
|
||||
href: 'javascript:;'
|
||||
|
||||
@ -80,8 +80,7 @@ ThreadHiding =
|
||||
href: 'javascript:;'
|
||||
$.on apply, 'click', ThreadHiding.menu.hide
|
||||
|
||||
makeStub = $.el 'label',
|
||||
innerHTML: "<input type=checkbox #{if Conf['Stubs'] then 'checked' else ''}> Make stub"
|
||||
makeStub = UI.checkbox 'Stubs', ' Make stub'
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
type: 'post'
|
||||
|
||||
@ -6,22 +6,14 @@ Header =
|
||||
className: 'menu-button'
|
||||
innerHTML: '<i></i>'
|
||||
|
||||
barFixedToggler = $.el 'label',
|
||||
innerHTML: '<input type=checkbox name="Fixed Header"> Fixed Header'
|
||||
headerToggler = $.el 'label',
|
||||
innerHTML: '<input type=checkbox name="Header auto-hide"> Auto-hide header'
|
||||
scrollHeaderToggler = $.el 'label',
|
||||
innerHTML: '<input type=checkbox name="Header auto-hide on scroll"> Auto-hide header on scroll'
|
||||
barPositionToggler = $.el 'label',
|
||||
innerHTML: '<input type=checkbox name="Bottom Header"> Bottom header'
|
||||
linkJustifyToggler = $.el 'label',
|
||||
innerHTML: "<input type=checkbox #{if Conf['Centered links'] then 'checked' else ''}> Centered links"
|
||||
customNavToggler = $.el 'label',
|
||||
innerHTML: '<input type=checkbox name="Custom Board Navigation"> Custom board navigation'
|
||||
footerToggler = $.el 'label',
|
||||
innerHTML: "<input type=checkbox #{unless Conf['Bottom Board List'] then 'checked' else ''}> Hide bottom board list"
|
||||
shortcutToggler = $.el 'label',
|
||||
innerHTML: "<input type=checkbox #{unless Conf['Shortcut Icons'] then 'checked' else ''}> Shortcut Icons"
|
||||
barFixedToggler = UI.checkbox 'Fixed Header', ' Fixed Header'
|
||||
headerToggler = UI.checkbox 'Header auto-hide', ' Auto-hide header'
|
||||
scrollHeaderToggler = UI.checkbox 'Header auto-hide on scroll', ' Auto-hide header on scroll'
|
||||
barPositionToggler = UI.checkbox 'Bottom Header', ' Bottom header'
|
||||
linkJustifyToggler = UI.checkbox 'Centered links', ' Centered links'
|
||||
customNavToggler = UI.checkbox 'Custom Board Navigation', ' Custom board navigation'
|
||||
footerToggler = UI.checkbox 'Bottom Board List', ' Hide bottom board list'
|
||||
shortcutToggler = UI.checkbox 'Shortcut Icons', ' Shortcut Icons'
|
||||
editCustomNav = $.el 'a',
|
||||
textContent: 'Edit custom board navigation'
|
||||
href: 'javascript:;'
|
||||
|
||||
@ -40,21 +40,14 @@ Index =
|
||||
$.on input, 'change', $.cb.value
|
||||
$.on input, 'change', @cb.sort
|
||||
|
||||
repliesEntry =
|
||||
el: $.el 'label',
|
||||
innerHTML: '<input type=checkbox name="Show Replies"> Show replies'
|
||||
anchorEntry =
|
||||
el: $.el 'label',
|
||||
innerHTML: '<input type=checkbox name="Anchor Hidden Threads"> Anchor hidden threads'
|
||||
title: 'Move hidden threads at the end of the index.'
|
||||
refNavEntry =
|
||||
el: $.el 'label',
|
||||
innerHTML: '<input type=checkbox name="Refreshed Navigation"> Refreshed navigation'
|
||||
title: 'Refresh index when navigating through pages.'
|
||||
repliesEntry = el: UI.checkbox 'Show Replies', ' Show replies'
|
||||
anchorEntry = el: UI.checkbox 'Anchor Hidden Threads', ' Anchor hidden threads'
|
||||
refNavEntry = el: UI.checkbox 'Refreshed Navigation', ' Refreshed navigation'
|
||||
anchorEntry.el.title = 'Move hidden threads at the end of the index.'
|
||||
refNavEntry.el.title = 'Refresh index when navigating through pages.'
|
||||
for label in [repliesEntry, anchorEntry, refNavEntry]
|
||||
input = label.el.firstChild
|
||||
{name} = input
|
||||
input.checked = Conf[name]
|
||||
$.on input, 'change', $.cb.checked
|
||||
switch name
|
||||
when 'Show Replies'
|
||||
|
||||
@ -95,8 +95,11 @@ Settings =
|
||||
innerHTML: "<legend>#{key}</legend>"
|
||||
for key, arr of obj
|
||||
description = arr[1]
|
||||
div = $.el 'div',
|
||||
innerHTML: "<label><input type=checkbox name=\"#{key}\">#{key}</label><span class=description>: #{description}</span>"
|
||||
div = $.el 'div'
|
||||
$.add div, [
|
||||
UI.checkbox key, key, false
|
||||
$.el 'span', class: 'description', textContent: ": #{description}"
|
||||
]
|
||||
input = $ 'input', div
|
||||
$.on input, 'change', $.cb.checked
|
||||
items[key] = Conf[key]
|
||||
|
||||
@ -373,9 +373,17 @@ UI = do ->
|
||||
<% } %>
|
||||
@cb.call @ if @cb
|
||||
|
||||
checkbox = (name, text, checked) ->
|
||||
checked = Conf[name] unless checked?
|
||||
label = $.el 'label'
|
||||
input = $.el 'input', {type: 'checkbox', name, checked}
|
||||
$.add label, [input, $.tn text]
|
||||
label
|
||||
|
||||
|
||||
return {
|
||||
dialog: dialog
|
||||
Menu: Menu
|
||||
hover: hoverstart
|
||||
dialog: dialog
|
||||
Menu: Menu
|
||||
hover: hoverstart
|
||||
checkbox: checkbox
|
||||
}
|
||||
|
||||
@ -4,9 +4,8 @@ FappeTyme =
|
||||
|
||||
for type in ["Fappe", "Werk"] when Conf["#{type} Tyme"]
|
||||
lc = type.toLowerCase()
|
||||
el = $.el 'label',
|
||||
innerHTML: "<input type=checkbox name=#{lc}> #{type} Tyme"
|
||||
title: "#{type} Tyme"
|
||||
el = UI.checkbox lc, " #{type} Tyme", false
|
||||
el.title = "#{type} Tyme"
|
||||
|
||||
FappeTyme[lc] = input = el.firstElementChild
|
||||
$.on input, 'change', FappeTyme.cb.toggle.bind input
|
||||
@ -34,4 +33,4 @@ FappeTyme =
|
||||
toggle: ->
|
||||
Conf[@name] = !Conf[@name]
|
||||
FappeTyme.cb.set @name
|
||||
$.cb.checked.call FappeTyme[@name]
|
||||
$.cb.checked.call FappeTyme[@name]
|
||||
|
||||
@ -258,12 +258,10 @@ Gallery =
|
||||
subEntries: subEntries
|
||||
|
||||
createSubEntry: (name) ->
|
||||
label = $.el 'label',
|
||||
innerHTML: "<input type=checkbox name='#{name}'> #{name}"
|
||||
label = UI.checkbox name, " #{name}"
|
||||
input = label.firstElementChild
|
||||
if name in ['Fit Width', 'Fit Height', 'Hide Thumbnails']
|
||||
$.on input, 'change', Gallery.cb.setFitness
|
||||
input.checked = Conf[name]
|
||||
$.event 'change', null, input
|
||||
$.on input, 'change', $.cb.checked
|
||||
el: label
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
CatalogLinks =
|
||||
init: ->
|
||||
return unless Conf['Catalog Links']
|
||||
CatalogLinks.el = el = $.el 'label',
|
||||
id: 'toggleCatalog'
|
||||
href: 'javascript:;'
|
||||
innerHTML: "<input type=checkbox #{if Conf['Header catalog links'] then 'checked' else ''}> Catalog Links"
|
||||
CatalogLinks.el = el = UI.checkbox 'Header catalog links', ' Catalog Links'
|
||||
el.id = 'toggleCatalog'
|
||||
|
||||
input = $ 'input', el
|
||||
$.on input, 'change', @toggle
|
||||
|
||||
@ -27,10 +27,8 @@ ThreadUpdater =
|
||||
|
||||
subEntries = []
|
||||
for name, conf of Config.updater.checkbox
|
||||
checked = if Conf[name] then 'checked' else ''
|
||||
el = $.el 'label',
|
||||
title: "#{conf[1]}"
|
||||
innerHTML: "<input name='#{name}' type=checkbox #{checked}> #{name}"
|
||||
el = UI.checkbox name, " #{name}"
|
||||
el.title = conf[1]
|
||||
input = el.firstElementChild
|
||||
$.on input, 'change', $.cb.checked
|
||||
if input.name is 'Scroll BG'
|
||||
|
||||
@ -302,11 +302,9 @@ ThreadWatcher =
|
||||
createSubEntry: (name, desc) ->
|
||||
entry =
|
||||
type: 'thread watcher'
|
||||
el: $.el 'label',
|
||||
innerHTML: "<input type=checkbox name='#{name}'> #{name}"
|
||||
title: desc
|
||||
el: UI.checkbox name, " #{name}"
|
||||
entry.el.title = desc
|
||||
input = entry.el.firstElementChild
|
||||
input.checked = Conf[name]
|
||||
$.on input, 'change', $.cb.checked
|
||||
$.on input, 'change', ThreadWatcher.refresh if name is 'Current Board'
|
||||
entry
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user