aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/gfx/demos/beautify.html
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
commite44a7e37b6c7b5961adaffc62b9042b8d442938e (patch)
tree95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dojox/gfx/demos/beautify.html
parenta62b9742ee5e28bcec6872d88f50f25b820914f6 (diff)
downloadsemanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz
semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/gfx/demos/beautify.html')
-rw-r--r--includes/js/dojox/gfx/demos/beautify.html48
1 files changed, 48 insertions, 0 deletions
diff --git a/includes/js/dojox/gfx/demos/beautify.html b/includes/js/dojox/gfx/demos/beautify.html
new file mode 100644
index 0000000..d1f02f5
--- /dev/null
+++ b/includes/js/dojox/gfx/demos/beautify.html
@@ -0,0 +1,48 @@
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
+<head>
+<title>Beautify JSON</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<style type="text/css">
+ @import "../../../dojo/resources/dojo.css";
+ @import "../../../dijit/tests/css/dijitTests.css";
+</style>
+<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
+<script type="text/javascript">
+
+trimPath = function(o){
+ if(o instanceof Array){
+ for(var i = 0; i < o.length; ++i){
+ trimPath(o[i]);
+ }
+ return;
+ }
+ if(("shape" in o) && ("path" in o.shape)){
+ o.shape.path = dojo.trim(o.shape.path.replace(/\s\s+/g, " "));
+ }
+ if("children" in o){
+ trimPath(o.children);
+ }
+};
+
+beautify = function(){
+ var t = dojo.byId("io");
+ var v = dojo.fromJson(t.value);
+ if(dojo.byId("path").checked){
+ trimPath(v);
+ }
+ t.value = dojo.toJson(v, dojo.byId("pprint").checked);
+};
+
+</script>
+</head>
+<body>
+ <h1>Beautify JSON</h1>
+ <p>Paste valid JSON in this textarea and receive a pretty-printed version of it. Use Firefox, if you want to be able to read comma-ended sequences (Python style).
+ Additionally it knows how to remove extra spaces from path elements.</p>
+ <p><textarea id="io" cols="80" rows="10" wrap="off"></textarea></p>
+ <p><button onclick="beautify()">Beautify!</button>
+ &nbsp;&nbsp;&nbsp;<input type="checkbox" id="path" checked="checked" />&nbsp;Process "path" elements
+ &nbsp;&nbsp;&nbsp;<input type="checkbox" id="pprint" checked="checked" />&nbsp;Pretty-print JSON</p>
+ <p><em>This program is a companion for inspector.html.</em></p>
+</body>
+</html>