summaryrefslogtreecommitdiff
path: root/web/static/dartboat.js
diff options
context:
space:
mode:
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,