diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-03-26 18:26:50 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-03-26 18:26:50 -0400 |
commit | 474fa30ad829b58eba6074e7ee14307418b07358 (patch) | |
tree | 07c0072a1323075a100a6b42f0101ebbaa90f3c8 /lib | |
parent | c088dec7eff828276b3e9e8891b7cdc041e65430 (diff) |
Chat example working nicely, but without dead channel removal
Diffstat (limited to 'lib')
-rw-r--r-- | lib/js/urweb.js | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index 6d405347..39f9f7cf 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -257,7 +257,7 @@ function listener() { if (isok) { var lines = xhr.responseText.split("\n"); if (lines.length < 2) - throw "Empty message from remote server"; + return; //throw "Empty message from remote server"; for (var i = 0; i+1 < lines.length; i += 2) { var chn = lines[i]; @@ -285,9 +285,9 @@ function listener() { connect(); } else { - try { + /*try { whine("Error querying remote server for messages! " + xhr.status); - } catch (e) { } + } catch (e) { }*/ } } }; @@ -300,10 +300,17 @@ function listener() { connect(); } +var listener_started = false; + function rv(chn, parse, k) { if (chn < 0) whine("Out-of-bounds channel receive"); + if (!listener_started) { + listener_started = true; + listener(); + } + var ch; if (chn >= channels.length || channels[chn] == null) { @@ -320,6 +327,10 @@ function rv(chn, parse, k) { } } -function unesc(s) { - return unescape(s).replace("+", " "); +function uf(s) { + return escape(s).replace(new RegExp ("/", "g"), "%2F"); +} + +function uu(s) { + return unescape(s).replace(new RegExp ("\\+", "g"), " "); } |