Permalink
Browse files

Improve output.

  • Loading branch information...
1 parent 978045d commit 9a997719be5a741410b00e95c50bff7a230ae06c @Connorhd committed Sep 8, 2009
Showing with 21 additions and 11 deletions.
  1. +4 −8 debug.js
  2. +17 −3 index.html
View
12 debug.js
@@ -114,7 +114,7 @@ setInterval(function () {
function hasChildren(obj) {
var children = false
- if (typeof(obj) !== 'string') {
+ if (typeof(obj) !== 'string' && !(obj instanceof String)) {
for (var j in obj) {
children = true;
break;
@@ -138,13 +138,9 @@ function getObj (id, cmd, key) {
var output = {};
output.id = '_root';
- try {
- output.text = JSON.stringify(obj);
- } catch (e) {
- output.text = obj.toString();
- }
+ output.text = obj.toString();
- output.text = '<code class="result">'+output.text+'</code>'
+ output.text = '<pre class="result">'+output.text+'</pre>'
if (hasChildren(obj) === true) {
output.hasChildren = true;
@@ -176,7 +172,7 @@ function getObj (id, cmd, key) {
cur = {id: key+'.'+i};
else
cur = {id: i};
- cur.text = '<strong>'+i+' - '+typeof(obj[i])+'</strong>';
+ cur.text = '<strong><span class="type">'+typeof(obj[i])+'</span>'+i+'</strong>';
var str;
try {
str = JSON.stringify(obj[i]);
View
20 index.html
@@ -159,10 +159,24 @@
display: block;
font-weight: bold;
}
-
- code {
- font-family: sans-serif;
+
+ code, pre {
max-height: 200px;
+ overflow: auto;
+ font-family: "Lucida Console", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", Consolas, "Andale Mono", "Courier New";
+ padding: 10px;
+ margin: 0;
+ }
+
+ pre.result {
+ padding: 0;
+ }
+
+ .type {
+ width: 6em;
+ color: #888;
+ display: block;
+ float: left;
}
body {

0 comments on commit 9a99771

Please sign in to comment.