diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-04 11:08:23 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-04 11:08:23 -0700 |
commit | a28369258b89e013103edcca20355eb61fffdf69 (patch) | |
tree | e514c8804fcdb5f282a012d8e8931b057585aba0 /web/static | |
parent | 3492c24cc533e9088e8b12f929f5d922c8787cba (diff) | |
download | dartboat-a28369258b89e013103edcca20355eb61fffdf69.tar.gz dartboat-a28369258b89e013103edcca20355eb61fffdf69.tar.xz |
formatting
Diffstat (limited to 'web/static')
-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)); }); |