diff lib/js/urweb.js @ 889:bcad392e288e

Tweaking demos a bit
author Adam Chlipala <adamc@hcoop.net>
date Fri, 17 Jul 2009 18:13:02 -0400
parents 0f7e2cca6d9b
children ae9e22822ec5
line wrap: on
line diff
--- a/lib/js/urweb.js	Fri Jul 17 17:14:23 2009 -0400
+++ b/lib/js/urweb.js	Fri Jul 17 18:13:02 2009 -0400
@@ -422,11 +422,11 @@
 }
 
 function uf(s) {
-  return escape(s).replace(new RegExp ("/", "g"), "%2F");
+  return escape(s).replace(new RegExp ("/", "g"), "%2F").replace(new RegExp ("\\+", "g"), "%2B");
 }
 
 function uu(s) {
-  return unescape(s).replace(new RegExp ("\\+", "g"), " ");
+  return unescape(s);
 }
 
 
@@ -564,7 +564,11 @@
       } catch (e) { }
 
       if (isok) {
-        var lines = xhr.responseText.split("\n");
+        var text = xhr.responseText
+        if (text == "")
+          return;
+        var lines = text.split("\n");
+
         if (lines.length < 2) {
           discon();
           return;
@@ -603,7 +607,7 @@
         try {
           if (xhr.status != 0)
             servErr("Error querying remote server for messages: " + xhr.status);
-        } catch (e) { servErr("Error querying remote server for messages"); }
+        } catch (e) { }
       }
     }
   };