1 function xynt_console(ena) {
6 this.win = window.open("","xyntconsole","scrollbars=yes,height=500,width=400,left=0,top=800");
9 conbody = this.win.document.getElementById("console_body");
11 conbody = this.win.document.createElement("body");
12 conbody.id = "console_body";
13 this.win.document.title = "xynt console";
16 condiv = this.win.document.getElementById("console_div");
18 condiv = this.win.document.createElement("div");
19 condiv.id = "console_div";
20 this.win.document.body.appendChild(condiv);
27 xynt_console.prototype = {
32 escapeHTML: function(s) {
34 return v.replace(/&/g,'&').
35 replace(/ /g,' ').
36 replace(/"/g,'"').
37 // replace(/'/g,''').
40 replace(/\n/g, "<br>\n");
47 if (typeof(s) == "string" || typeof(s) == "function") {
48 this.div.innerHTML += this.escapeHTML(s);
54 this.div.innerHTML += "<hr style=\"height: 1px;\">\n";
55 this.win.document.body.scrollTop = 10000000;
58 dump_obj: function(s, ind) {
61 sind = "<span style=\"background-color:#f0f0f0;\">";
62 for (i = 0 ; i < ind ; i++) {
67 if (typeof(s[i]) == 'string' || typeof(s[i]) == "function") {
69 var arr = this.escapeHTML(s[i]).split("\n");
71 ret += sind + arr[el] + "\n";
73 // this.div.innerHTML += "xx["+this.escapeHTML(i) + "] : [" + ret + "]<hr style=\"height: 1px; width: 100px;\"><br>\n";
74 this.div.innerHTML += this.escapeHTML(i)+"<br>\n";
75 this.div.innerHTML += ret + "<hr style=\"height: 1px; width: 100px;\"><br>\n";
78 this.dump_obj(s[i], ind+4);
81 // this.div.innerHTML += "post-loop<br>";
88 this.div.innerHTML += s + "<br>";
89 this.win.document.body.scrollTop = 10000000;
102 var is_xynt_console = false;
103 var console_enable = true;
105 if(typeof(console) == "undefined") {
108 console = new xynt_console(console_enable);
110 is_xynt_console = true;
113 // conzole.logger = console.log;
114 // conzole.log = function () { return 0; }
117 function deconsole() {
118 if (is_xynt_console) {
123 function log_walk(curtag)
126 var ancestor = curtag;
128 console.log(spcs("_", "+", ind)+" ["+curtag.tagName+"] nodeType: "+curtag.nodeType+" inner: ["+curtag.innerHTML+"]");
129 if (curtag.firstChild != null && curtag.tagName != "TD") {
131 curtag = curtag.firstChild;
133 else if (curtag.nextSibling != null) {
134 curtag = curtag.nextSibling;
136 else if (curtag.parentNode.nextSibling != null) {
138 curtag = curtag.parentNode.nextSibling;
142 } while (curtag != null && curtag != ancestor);