From 2886add52aeed172289f3bddd995eda0b0c92a67 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Thu, 19 May 2022 15:24:06 -0700 Subject: web: display darts for comp as player 1 --- web/static/dartboat.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'web/static/dartboat.js') 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, -- cgit v1.2.3-70-g09d2