summaryrefslogtreecommitdiff
path: root/lib/js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/js')
-rw-r--r--lib/js/urweb.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 08d96040..9f93120f 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -174,3 +174,40 @@ function rc(uri, parse, k) {
xhr.open("GET", uri, true);
xhr.send(null);
}
+
+
+var client_id = 0;
+var client_pass = 0;
+var url_prefix = "/";
+
+function path_join(s1, s2) {
+ if (s1.length > 0 && s1[s1.length-1] == '/')
+ return s1 + s2;
+ else
+ return s1 + "/" + s2;
+}
+
+function listener() {
+ var xhr = getXHR();
+
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4) {
+ var isok = false;
+
+ try {
+ if (xhr.status == 200)
+ isok = true;
+ } catch (e) { }
+
+ if (isok)
+ alert("Messages: " + xhr.responseText);
+ else {
+ alert("Error querying remote server for messages!");
+ throw "Error querying remote server for messages!";
+ }
+ }
+ };
+
+ xhr.open("GET", path_join(url_prefix, ".msgs/" + client_id + "/" + client_pass), true);
+ xhr.send(null);
+}