aboutsummaryrefslogtreecommitdiff
path: root/examples/browser_test.html
diff options
context:
space:
mode:
authorJosef Salyer <[email protected]>2013-07-28 12:15:49 -0400
committerJosef Salyer <[email protected]>2013-07-28 12:15:49 -0400
commitd21bb4156b44b619c8d207714ea42727441e88b4 (patch)
treee5fd534adb6355e90795509d07d3483569d287a4 /examples/browser_test.html
parent12807aea877d80d39c06fbf89f81cb09d63a40d6 (diff)
parent1bd1d73d29222c4e2f52d63a4282345b63a324df (diff)
downloadfaker-d21bb4156b44b619c8d207714ea42727441e88b4.tar.xz
faker-d21bb4156b44b619c8d207714ea42727441e88b4.zip
added a bunch of test, changed format of many files to match the newer style
Diffstat (limited to 'examples/browser_test.html')
-rw-r--r--examples/browser_test.html41
1 files changed, 41 insertions, 0 deletions
diff --git a/examples/browser_test.html b/examples/browser_test.html
new file mode 100644
index 00000000..afe81bec
--- /dev/null
+++ b/examples/browser_test.html
@@ -0,0 +1,41 @@
+<html>
+ <head>
+ <script src = "../Faker.js" type = "text/javascript"></script>
+ <script>
+ var card = Faker.Helpers.createCard();
+ if(typeof JSON == 'undefined'){
+ document.write('get a real browser that has JSON.stringify and JSON.parse built in <br/>');
+ // implement JSON.stringify serialization
+ var JSON = {};
+ JSON.stringify = function (obj) {
+ var t = typeof (obj);
+ if (t != "object" || obj === null) {
+ // simple data type
+ if (t == "string") obj = '"'+obj+'"';
+ return String(obj);
+ }
+ else {
+ // recurse array or object
+ var n, v, json = [], arr = (obj && obj.constructor == Array);
+ for (n in obj) {
+ v = obj[n]; t = typeof(v);
+ if (t == "string") v = '"'+v+'"';
+ else if (t == "object" && v !== null) v = JSON.stringify(v);
+ json.push((arr ? "" : '"' + n + '":') + String(v));
+ }
+ return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}");
+ }
+ };
+ }
+ document.write(JSON.stringify(card));
+
+ </script>
+ </head>
+ <body>
+ </body>
+</html>
+
+
+
+
+