1 function xynt_console(ena) {
6 this.win = window.open("","xyntconsole","scrollbars=yes,height=500,width=800,left=0,top=800");
8 conbody = this.win.document.createElement("body");
9 this.div = condiv = this.win.document.createElement("div");
11 conbody.id = "console_body";
12 this.win.document.body.appendChild(condiv);
13 this.win.document.title = "xynt console";
17 xynt_console.prototype = {
22 escapeHTML: function(s) {
24 return v.replace(/&/g,'&').
25 replace(/ /g,' ').
26 replace(/"/g,'"').
27 // replace(/'/g,''').
30 replace(/\n/g, "<br>\n");
37 if (typeof(s) == "string" || typeof(s) == "function") {
38 this.div.innerHTML += this.escapeHTML(s);
44 this.div.innerHTML += "<hr style=\"height: 1px;\">\n";
45 this.win.document.body.scrollTop = 10000000;
48 dump_obj: function(s, ind) {
51 sind = "<span style=\"background-color:#f0f0f0;\">";
52 for (i = 0 ; i < ind ; i++) {
57 if (typeof(s[i]) == 'string' || typeof(s[i]) == "function") {
59 var arr = this.escapeHTML(s[i]).split("\n");
61 ret += sind + arr[el] + "\n";
63 // this.div.innerHTML += "xx["+this.escapeHTML(i) + "] : [" + ret + "]<hr style=\"height: 1px; width: 100px;\"><br>\n";
64 this.div.innerHTML += this.escapeHTML(i)+"<br>\n";
65 this.div.innerHTML += ret + "<hr style=\"height: 1px; width: 100px;\"><br>\n";
68 this.dump_obj(s[i], ind+4);
71 // this.div.innerHTML += "post-loop<br>";
78 this.div.innerHTML += s + "<br>";
79 this.win.document.body.scrollTop = 10000000;
92 var is_xynt_console = false;
93 var console_enable = true;
95 if(typeof(console) == "undefined") {
98 console = new xynt_console(console_enable);
100 is_xynt_console = true;
103 // conzole.logger = console.log;
104 // conzole.log = function () { return 0; }
106 function deconsole() {
107 if (is_xynt_console) {
112 function log_walk(curtag)
115 var ancestor = curtag;
117 console.log(spcs("_", "+", ind)+" ["+curtag.tagName+"] nodeType: "+curtag.nodeType+" inner: ["+curtag.innerHTML+"]");
118 if (curtag.firstChild != null && curtag.tagName != "TD") {
120 curtag = curtag.firstChild;
122 else if (curtag.nextSibling != null) {
123 curtag = curtag.nextSibling;
125 else if (curtag.parentNode.nextSibling != null) {
127 curtag = curtag.parentNode.nextSibling;
131 } while (curtag != null && curtag != ancestor);