diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-03 21:25:44 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-03 21:25:44 -0700 |
commit | 1ab3c4995e44f44a845dce7b241554c0621527b9 (patch) | |
tree | af02db07c5873f893b1506d224ac78c1fd2fefbd /web/static | |
parent | e091cdb3187b60a9901bd14d475eebc481c9a299 (diff) | |
download | dartboat-1ab3c4995e44f44a845dce7b241554c0621527b9.tar.gz dartboat-1ab3c4995e44f44a845dce7b241554c0621527b9.tar.xz |
web: use generic JS function for updating opt elems
Diffstat (limited to 'web/static')
-rw-r--r-- | web/static/dartboat.js | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/web/static/dartboat.js b/web/static/dartboat.js index 44daabb..4edba8a 100644 --- a/web/static/dartboat.js +++ b/web/static/dartboat.js @@ -37,6 +37,10 @@ function elemSetContent(sel, str) { $(UTF8ToString(sel)).textContent = str ? UTF8ToString(str) : ''; } +function elemSetValue(sel, str) { + $(UTF8ToString(sel)).value = str ? UTF8ToString(str) : ''; +} + function elemHasClass(sel, c) { return $(UTF8ToString(sel)).classList.contains(UTF8ToString(c)); } @@ -65,15 +69,6 @@ function elemScrollToBottom(sel) { e.scrollTop = e.scrollHeight; } -function promptHandle(command, data) { - const str_c = toCString(command); - const str_d = data && toCString(data); - _prompt_handle(str_c, str_d); - - _free(str_c); - if (str_d) _free(str_d); -} - function elemAppendElemv(sel, elemc, elemv, off_ns, off_name, off_content, off_n_attrs, off_attr_names, off_attr_vals) { const target = $(UTF8ToString(sel)); @@ -102,12 +97,13 @@ function elemAppendElemv(sel, elemc, elemv, off_ns, off_name, off_content, } } -function updateDelay(val) { - $('#delay').value = val; -} +function promptHandle(command, data) { + const str_c = toCString(command); + const str_d = data && toCString(data); + _prompt_handle(str_c, str_d); -function updateStdev(val) { - $('#stdev').value = parseFloat(val.toFixed(2).slice(0, 4)); + _free(str_c); + if (str_d) _free(str_d); } function setOpt(opt, val, update_opts = true) { |