*/
function scrollDown() {
- var stream_metabox = document.getElementById("stream-metabox");
+ var stream_metabox = document.getElementById("stream-metabox");o
stream_metabox.scrollTop = stream_metabox.scrollHeight;
}
});
}
+function setConnectedText(string, to_class) {
+ var stream_metabox = document.getElementById("connection-status");
+ stream_metabox.textContent = "[" + string + "]";
+ stream_metabox.setAttribute("class", to_class);
+}
+
function installWebsocket() {
// TODO: Don't hardcode the websocket path; pull it from the DOM
var address = "ws://".concat(window.location.hostname, ":", window.location.port);
displayMessage(evt.data, false);
};
ws.onopen = function() {
+ setConnectedText("connected", "connected");
console.log("connected");
};
ws.onclose = function () {
+ setConnectedText("disconnected", "disconnected");
+ // kludge, we shouldn't be using self_sent like this because it
+ // wipes the input
+ displayMessage(
+ "* You have been disconnected. Refresh to (hopefully) reconnect.",
+ true);
console.log("closed websocket");
};
installUIHooks(ws);
;; (p (b "<bar>") " Last one!"))
))
(div (@ (id "input-metabox"))
- (input (@ (id "main-input"))))))
+ (input (@ (id "main-input")))
+ " "
+ (span (@ (id "connection-status")
+ (class "disconnected"))
+ "[disconnected]"))))
(define (main-tmpl)
`(html (@ (xmlns "http://www.w3.org/1999/xhtml"))