diff options
author | 2009-03-26 18:26:50 -0400 | |
---|---|---|
committer | 2009-03-26 18:26:50 -0400 | |
commit | 754569fc0cf4affbf1227c44059352316a61fa24 (patch) | |
tree | 07c0072a1323075a100a6b42f0101ebbaa90f3c8 /lib/js/urweb.js | |
parent | dac2c194b1416d7710081d5c57c24d52e110a224 (diff) |
Chat example working nicely, but without dead channel removal
Diffstat (limited to 'lib/js/urweb.js')
-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"), " "); } |