+function scrollDown() {
+ var stream_metabox = document.getElementById("stream-metabox");o
+ stream_metabox.scrollTop = stream_metabox.scrollHeight;
+}
+
+function withMaybeScroll(thunk) {
+ var stream_metabox = document.getElementById("stream-metabox");
+ var should_scroll = false;
+ // if within a reasonable threshold, we scroll
+ if((stream_metabox.scrollHeight - stream_metabox.offsetHeight)
+ - stream_metabox.scrollTop <= 50) {
+ should_scroll = true;
+ }
+ thunk();
+ if (should_scroll) {
+ stream_metabox.scrollTop = stream_metabox.scrollHeight;
+ }
+}
+
+
+function displayMessage(data, self_sent) {