diff options
Diffstat (limited to 'web/static/dartboat.js')
-rw-r--r-- | web/static/dartboat.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/web/static/dartboat.js b/web/static/dartboat.js index 70e4677..e09e8f6 100644 --- a/web/static/dartboat.js +++ b/web/static/dartboat.js @@ -46,8 +46,8 @@ function elemToggleClass(sel, c) { function elemSetUniqClass(sel, c, sel_set) { selstr = sel && UTF8ToString(sel); cstr = UTF8ToString(c); - $$(UTF8ToString(sel_set)).forEach(e => - e.classList[sel && e.matches(selstr) ? 'add' : 'remove'](cstr)); + $$(UTF8ToString(sel_set)).forEach(e => e.classList[ + sel && e.matches(selstr) ? 'add' : 'remove'](cstr)); } function elemScrollToBottom(sel) { @@ -64,16 +64,21 @@ function elemAppendElemv(sel, elemc, elemv, off_ns, off_name, off_content, const nsptr = HEAP32[(struct + off_ns)>>2]; const name = UTF8ToString(HEAP32[(struct + off_name)>>2]); - const e = nsptr ? document.createElementNS(UTF8ToString(nsptr), name) : + const e = nsptr ? + document.createElementNS(UTF8ToString(nsptr), name) : document.createElement(name); const n_attrs = HEAP32[(struct + off_n_attrs)>>2]; if (n_attrs) { - const attr_names = HEAP32[(struct + off_attr_names)>>2]; + const attr_names = + HEAP32[(struct + off_attr_names)>>2]; const attr_vals = HEAP32[(struct + off_attr_vals)>>2]; for (let i = 0; i < n_attrs; ++i) - e.setAttribute(UTF8ToString(HEAP32[(attr_names + i*4)>>2]), - UTF8ToString(HEAP32[(attr_vals + i*4)>>2])); + e.setAttribute( + UTF8ToString( + HEAP32[(attr_names + i*4)>>2]), + UTF8ToString( + HEAP32[(attr_vals + i*4)>>2])); } const content = HEAP32[(struct + off_content)>>2]; @@ -121,7 +126,9 @@ document.addEventListener('DOMContentLoaded', () => { f = e => $(`#${e.target.dataset.modal}`).style.display = 'block'; $$('[data-modal]').forEach(x => x.addEventListener('click', f)); f = e => { - if (e.target === e.currentTarget) e.target.style.display = 'none'; }; + if (e.target === e.currentTarget) + e.target.style.display = 'none'; + }; $$('.modal').forEach(x => x.addEventListener('click', f)); }); |