]> _ Git - fluidbook-html5.git/commitdiff
(no commit message)
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 15 Nov 2013 09:52:51 +0000 (09:52 +0000)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 15 Nov 2013 09:52:51 +0000 (09:52 +0000)
js/libs/cube/util.js
js/libs/fluidbook/fluidbook.cache.js
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.l10n.js

index 8fe8744cdb893c37340f6ec531db9efd92de28af..3aa9be9df44c6007866308388f079ae4b3bb5155 100644 (file)
@@ -13,6 +13,15 @@ function arrayRemove(array, element) {
        return array;
 }
 
+function json_parse(str) {
+       try {
+               return JSON.parse(str);
+       } catch (err) {
+               fb(err);
+               fb(str);
+       }
+}
+
 function trim(str, charlist) {
        // http://kevin.vanzonneveld.net
        // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
index 7482ddbf9e0965f10f500acba7e756244236dce1..5ef4632e831fcc5325530ebf775c93d7aad550ac 100644 (file)
@@ -44,7 +44,7 @@ FluidbookCache.prototype = {
                }
                var f = res.substr(0, 1);
                if (f == '[' || f == '{') {
-                       res = JSON.parse(res);
+                       res = json_parse(res);
                }
                return res;
        },
index 623b31fc24715f3ec2a15377d49cdea444b08b09..b739e5a96dc2030e22c31b2482d08efb47942164 100644 (file)
@@ -484,7 +484,7 @@ Fluidbook.prototype = {
                        }\r
                }\r
                res.loading = [res.currentLeft, res.currentRight];\r
-               return JSON.parse(JSON.stringify(res));\r
+               return json_parse(JSON.stringify(res));\r
        },\r
        reloadCurrentPage: function() {\r
                this.pageTransition(this.currentPage);\r
index e238c70a243f81636c21cbd3d2ccf4cd994ad6f6..243bcf4179103cd6e999dac5ed215e07d36a6a01 100644 (file)
@@ -40,7 +40,7 @@ FluidbookL10N.prototype = {
                } else {
                        force = true;
                        try {
-                               forceLocales = JSON.parse(forceLocales);
+                               forceLocales = json_parse(forceLocales);
                        } catch (err) {
                                force = false;
                        }