summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weber2009-11-27 10:42:57 +0000
committerChristian Weber2009-11-27 10:42:57 +0000
commit93656aabcdb925fb14795f342e209bca59538f24 (patch)
tree11824651938f67d51a3572196e496cc14d153736
parentbdb6344bc56252553678c38bb550ab6fea64812c (diff)
downloaditools-93656aabcdb925fb14795f342e209bca59538f24.tar.gz
itools-93656aabcdb925fb14795f342e209bca59538f24.tar.bz2
itools-93656aabcdb925fb14795f342e209bca59538f24.zip
ED() creates jsdebug div if it doesn't exist
-rw-r--r--itjs/it.js42
1 files changed, 21 insertions, 21 deletions
diff --git a/itjs/it.js b/itjs/it.js
index 7fb02bc..413bad0 100644
--- a/itjs/it.js
+++ b/itjs/it.js
@@ -15,41 +15,41 @@ function CED(txt)
*/
function ED()
{
- var element = document.getElementById('jsdebug');
- if (element)
+ var element;
+ var text = "";
+
+ if (!(element = document.getElementById('jsdebug')))
+ var element = it_create_element(document.body, 'div', {id:'jsdebug', style:{position:'absolute', left:'100px', top:'10px', opacity:'0.8'}})
+
+ for (var i = 0; i < arguments.length; i++)
{
- var text = "";
+ var variable = arguments[i];
- for (var i = 0; i < arguments.length; i++)
- {
- var variable = arguments[i];
+ if (typeof variable == "string")
+ variable = variable.replace(/&/g, '&amp;').replace(new RegExp("<", "g"), '&lt;');
- if (typeof variable == "string")
- variable = variable.replace(/&/g, '&amp;').replace(new RegExp("<", "g"), '&lt;');
+ text += (typeof variable) + " " + variable;
- text += (typeof variable) + " " + variable;
+ if (typeof variable == "object")
+ {
+ text += ":";
- if (typeof variable == "object")
+ for (field in variable)
{
- text += ":";
-
- for (field in variable)
- {
- text += field + "=";
+ text += field + "=";
- try { text += typeof variable[field] == 'function' ? 'function' : variable[field]; }
- catch (e) { text += "*" + e + "*"; }
+ try { text += typeof variable[field] == 'function' ? 'function' : variable[field]; }
+ catch (e) { text += "*" + e + "*"; }
- text += "\n";
- }
text += "\n";
}
-
text += "\n";
}
- element.innerHTML += '<pre style="background-color:#FEE; margin:0">' + text + '<' + '/pre>';
+ text += "\n";
}
+
+ element.innerHTML += '<pre style="background-color:#FEE; margin:0">' + text + '<' + '/pre>';
}
/**