archematics/src/options.civet

18 lines
602 B
Plaintext

import {flags} from ./adapptypes.ts
cache := await browser.storage.local.get flags
for each box of flags
checkbox := document.getElementById(box) as HTMLInputElement
unless checkbox then continue
if box in cache
checkbox.checked = cache[box]
else
checkbox.checked = box is 'vrmlview' or box is 'joyce'
browser.storage.local.set [box]: checkbox.checked
document.body.addEventListener 'click', (event) ->
elt := event.target as HTMLInputElement
unless elt.tagName is 'INPUT' and elt.type is 'checkbox' then return
browser.storage.local.set [elt.id]: elt.checked