X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=blobdiff_plain;f=data%2Fweb-static%2Fjs%2Fmudsync.js;h=b926c146b8b8c84eda2af175aefe2398fc6a6c35;hp=90f3daa4ef9af9d995cf1c0649a6c19ab1ff0c71;hb=7197e223d181722f6df49acb979c0d2f9f2c9551;hpb=829df0120213f2bf7420b8ae153e761feb675106 diff --git a/data/web-static/js/mudsync.js b/data/web-static/js/mudsync.js index 90f3daa..b926c14 100644 --- a/data/web-static/js/mudsync.js +++ b/data/web-static/js/mudsync.js @@ -27,9 +27,9 @@ function displayMessage(data, self_sent) { - stream_metabox.offsetHeight)) { should_scroll = true; } - document.getElementById("main-input").value = ""; if (self_sent) { new_entry.setAttribute("class", "stream-entry self-sent"); + document.getElementById("main-input").value = ""; } else { new_entry.setAttribute("class", "stream-entry"); } @@ -42,7 +42,8 @@ function displayMessage(data, self_sent) { function installWebsocket() { // TODO: Don't hardcode the websocket path; pull it from the DOM - var ws = new WebSocket("ws://127.0.0.1:8888"); + var address = "ws://".concat(window.location.hostname, ":", window.location.port); + var ws = new WebSocket(address); ws.onmessage = function(evt) { displayMessage(evt.data, false); };