Skip to content
Browse files

Display arrays in a more structured way, rather than just outputting …

…them as strings.
  • Loading branch information...
1 parent 1f40f6f commit 4f7314d666f52b9d7842b41cd1a46b25b0bb20ca @ebryn ebryn committed Jul 23, 2011
Showing with 40 additions and 2 deletions.
  1. +40 −2 wot.html
View
42 wot.html
@@ -23,10 +23,28 @@
ul.monospace {
font-family: Menlo, Monaco, monospace;
list-style-type: none;
- margin: 0 0 10px 10px;
+ margin: 0 0 10px 20px;
padding-left: 0;
}
+ ol.array {
+ list-style: none;
+ padding-left: 10px;
+ }
+
+ li.array {
+ margin-left: -10px;
+ padding-left: 10px;
+ background: url(tree-down.png) no-repeat 0 4px;
+ }
+
+ ol.array li {
+ float: left;
+ margin-right: 5px;
+ }
+ ol.array li:not(:last-child):after {
+ content: ', ';
+ }
.prop-name {
color: #881391;
}
@@ -116,9 +134,29 @@ <h1 {{^ifProps}}class='no-props'{{/ifProps}}><span>{{type}}{{^ifProps}} (none){{
buffer = buffer + "<ul class='monospace'>";
+ function simpleProp(klassProp) {
+ var buffer = "<li><span class='prop-name'>" + klassProp.name + "</span>: ";
+ buffer += "<span class='prop-value'>" + klassProp.value + "</span></li>";
+ return buffer;
+ }
+
for (prop in klass.properties) {
klassProp = klass.properties[prop];
- buffer = buffer + "<li><span class='prop-name'>" + klassProp.name + "</span>: <span class='prop-value'>" + klassProp.value + "</span></li>";
+ if (klassProp.value.charAt(0) == '[' && klassProp.value.substring(0, 7) != '[object') {
+ var propArray = klassProp.value.replace(/^\[|\]$/g, '').split(',');
+ if (propArray.length > 0 && propArray.toString() != "") {
+ buffer += "<li class='array'><span class='prop-name'>" + klassProp.name + "</span>: ";
+ buffer += "[<ol class='array'>";
+ for (var i = 0; i < propArray.length; i++) {
+ buffer += "<li><span class='prop-value'>" + propArray[i] + "</span></li>";
+ }
+ buffer += "</ol><div style='clear: left;'></div>]</li>";
+ } else {
+ buffer += simpleProp(klassProp);
+ }
+ } else {
+ buffer += simpleProp(klassProp);
+ }
}
buffer = buffer + "</ul>";

0 comments on commit 4f7314d

Please sign in to comment.
Something went wrong with that request. Please try again.