From 93656aabcdb925fb14795f342e209bca59538f24 Mon Sep 17 00:00:00 2001 From: Christian Weber Date: Fri, 27 Nov 2009 10:42:57 +0000 Subject: ED() creates jsdebug div if it doesn't exist --- itjs/it.js | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'itjs/it.js') 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, '&').replace(new RegExp("<", "g"), '<'); - if (typeof variable == "string") - variable = variable.replace(/&/g, '&').replace(new RegExp("<", "g"), '<'); + 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 += '
' + text + '<' + '/pre>'; + text += "\n"; } + + element.innerHTML += '' + text + '<' + '/pre>'; } /** -- cgit v1.2.3