Make this settings code easier to maintain.
This commit is contained in:
parent
10f5f60b7f
commit
a2b80dce04
@ -561,10 +561,13 @@ Settings =
|
|||||||
$.id('lastarchivecheck').textContent = 'never'
|
$.id('lastarchivecheck').textContent = 'never'
|
||||||
|
|
||||||
items = {}
|
items = {}
|
||||||
for name in ['archiveLists', 'archiveAutoUpdate', 'fourchanImageHost', 'captchaLanguage', 'captchaServiceDomain', 'boardnav', 'time', 'timeLocale', 'backlink', 'pastedname', 'fileInfo', 'QR.personas', 'favicon', 'usercss', 'customCooldown', 'jsWhitelist']
|
for name, input of inputs when name not in ['captchaServiceKey', 'Interval', 'Custom CSS']
|
||||||
items[name] = Conf[name]
|
items[name] = Conf[name]
|
||||||
input = inputs[name]
|
event = if (
|
||||||
event = if name in ['archiveLists', 'archiveAutoUpdate', 'QR.personas', 'favicon', 'usercss'] then 'change' else 'input'
|
input.nodeName is 'SELECT' or
|
||||||
|
input.type in ['checkbox', 'radio'] or
|
||||||
|
(input.nodeName is 'TEXTAREA' and name not of Settings)
|
||||||
|
) then 'change' else 'input'
|
||||||
$.on input, event, $.cb[if input.type is 'checkbox' then 'checked' else 'value']
|
$.on input, event, $.cb[if input.type is 'checkbox' then 'checked' else 'value']
|
||||||
$.on input, event, Settings[name] if name of Settings
|
$.on input, event, Settings[name] if name of Settings
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user