summaryrefslogtreecommitdiff
path: root/web/static/dartboat.js
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-19 15:24:06 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-19 15:24:06 -0700
commit2886add52aeed172289f3bddd995eda0b0c92a67 (patch)
tree27a9802c0364f5e98a12fdfe2155a85d7ec5f5e8 /web/static/dartboat.js
parent8956650dccfe1707005ef8be3655a4d986805312 (diff)
downloaddartboat-2886add52aeed172289f3bddd995eda0b0c92a67.tar.gz
dartboat-2886add52aeed172289f3bddd995eda0b0c92a67.tar.xz
web: display darts for comp as player 1
Diffstat (limited to 'web/static/dartboat.js')
-rw-r--r--web/static/dartboat.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/web/static/dartboat.js b/web/static/dartboat.js
index a46ffc9..54cb29b 100644
--- a/web/static/dartboat.js
+++ b/web/static/dartboat.js
@@ -55,6 +55,15 @@ function elemScrollToBottom(sel) {
e.scrollTop = e.scrollHeight;
}
+function elemScrollToCenterChild(sel, sel_child) {
+ const e = $(UTF8ToString(sel));
+ const child = $(UTF8ToString(sel_child));
+ if (!child) return;
+
+ e.scrollLeft = child.offsetLeft + child.offsetWidth/2 -
+ e.offsetLeft - e.offsetWidth/2;
+}
+
function targetAppendElemv(target, elemc, elemv,
off_type, off_ns, off_name, off_content,
off_n_attrs, off_attr_names, off_attr_vals,