projects
/
mudsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
You can take the disc, yes
[mudsync.git]
/
data
/
web-static
/
js
/
mudsync.js
diff --git
a/data/web-static/js/mudsync.js
b/data/web-static/js/mudsync.js
index 0e7ebe6f1c94abc23f64b582c8f87ea0c06436c3..c5c937ed47dbe0932c9040c7307e0ac2dedad7b5 100644
(file)
--- a/
data/web-static/js/mudsync.js
+++ b/
data/web-static/js/mudsync.js
@@
-1,6
+1,6
@@
/*
;;; Mudsync --- Live hackable MUD
/*
;;; Mudsync --- Live hackable MUD
-;;; Copyright © 2017 Christ
opher Allan
Webber <cwebber@dustycloud.org>
+;;; Copyright © 2017 Christ
ine Lemmer-
Webber <cwebber@dustycloud.org>
;;;
;;; This file is part of Mudsync.
;;;
;;;
;;; This file is part of Mudsync.
;;;
@@
-19,7
+19,7
@@
*/
function scrollDown() {
*/
function scrollDown() {
- var stream_metabox = document.getElementById("stream-metabox");
+ var stream_metabox = document.getElementById("stream-metabox");
o
stream_metabox.scrollTop = stream_metabox.scrollHeight;
}
stream_metabox.scrollTop = stream_metabox.scrollHeight;
}
@@
-53,6
+53,12
@@
function displayMessage(data, self_sent) {
});
}
});
}
+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);
function installWebsocket() {
// TODO: Don't hardcode the websocket path; pull it from the DOM
var address = "ws://".concat(window.location.hostname, ":", window.location.port);
@@
-61,9
+67,16
@@
function installWebsocket() {
displayMessage(evt.data, false);
};
ws.onopen = function() {
displayMessage(evt.data, false);
};
ws.onopen = function() {
+ setConnectedText("connected", "connected");
console.log("connected");
};
ws.onclose = function () {
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);
console.log("closed websocket");
};
installUIHooks(ws);