* Fallback to eval() method for JSON loading if the native JSON object (FF 3.5, IE8...
authorMatt <matt@uncensored.citadel.org>
Tue, 21 Jul 2009 04:01:33 +0000 (04:01 +0000)
committerMatt <matt@uncensored.citadel.org>
Tue, 21 Jul 2009 04:01:33 +0000 (04:01 +0000)
* Silence any harmless errors caught in IE

webcit/static/summaryview.js

index eb9e2ebe1119164791002c6d314f383884d70057..23be534f28c4545d530e785bb98124f9fa3f42e2 100644 (file)
@@ -106,9 +106,15 @@ new Ajax.Request("roommsgs", {
        });
 }
 function evalJSON(data) {
+  var jsonData = null;
   if (typeof(JSON) === 'object' && typeof(JSON.parse) === 'function') {
-    return JSON.parse(data);
-  } else {
+    try {
+    jsonData = JSON.parse(data);
+    } catch (e) {
+      // ignore
+    }
+  }
+  if (jsonData == null) {
     return eval('('+data+')');
   }
 }
@@ -182,7 +188,7 @@ function resortAndDisplay(sortMode) {
     var i = x+1;
     compiled[i] = trTemplate.join("");
     } catch (e) {
-      alert("Exception on row " +  x + ":" + e);
+      WCLog("Exception on row " +  x + ":" + e);
     }
   }
   compiled[length+2] = "</tbody>";