1 function xynt_console(ena) {
6 this.win = window.open("","xynt console","navigation=no,scrollbars=yes,height=500,width=800,left=0,top=800");
7 // titl = this.win.document.createElement("title");
8 // titl.innerHTML = "xynt console";
9 conbody = this.win.document.createElement("body");
10 this.div = condiv = this.win.document.createElement("div");
12 conbody.id = "console_body";
13 // this.win.document.head.appendChild(titl);
14 this.win.document.body.appendChild(condiv);
15 this.win.document.title = "xynt console";
19 xynt_console.prototype = {
24 escapeHTML: function(s) {
26 return v.replace(/&/g,'&').
27 replace(/ /g,' ').
28 replace(/"/g,'"').
29 // replace(/'/g,''').
32 replace(/\n/g, "<br>\n");
39 if (typeof(s) == "string" || typeof(s) == "function") {
40 this.div.innerHTML += this.escapeHTML(s);
46 this.div.innerHTML += "<hr style=\"height: 1px;\">\n";
47 this.win.document.body.scrollTop = 10000000;
50 dump_obj: function(s, ind) {
53 sind = "<span style=\"background-color:#f0f0f0;\">";
54 for (i = 0 ; i < ind ; i++) {
59 if (typeof(s[i]) == 'string' || typeof(s[i]) == "function") {
61 var arr = this.escapeHTML(s[i]).split("\n");
63 ret += sind + arr[el] + "\n";
65 // this.div.innerHTML += "xx["+this.escapeHTML(i) + "] : [" + ret + "]<hr style=\"height: 1px; width: 100px;\"><br>\n";
66 this.div.innerHTML += this.escapeHTML(i)+"<br>\n";
67 this.div.innerHTML += ret + "<hr style=\"height: 1px; width: 100px;\"><br>\n";
70 this.dump_obj(s[i], ind+4);
73 // this.div.innerHTML += "post-loop<br>";
80 this.div.innerHTML += s + "<br>";
81 this.win.document.body.scrollTop = 10000000;
94 var is_xynt_console = false;
95 var console_enable = true;
97 if(typeof(console) == "undefined") {
100 console = new xynt_console(console_enable);
102 is_xynt_console = true;
105 // console.logger = console.log;
106 // console.log = function () { return 0; }
109 function deconsole() {
110 if (is_xynt_console) {
115 function log_walk(curtag)
118 var ancestor = curtag;
120 console.log(spcs("_", "+", ind)+" ["+curtag.tagName+"] nodeType: "+curtag.nodeType+" inner: ["+curtag.innerHTML+"]");
121 if (curtag.firstChild != null && curtag.tagName != "TD") {
123 curtag = curtag.firstChild;
125 else if (curtag.nextSibling != null) {
126 curtag = curtag.nextSibling;
128 else if (curtag.parentNode.nextSibling != null) {
130 curtag = curtag.parentNode.nextSibling;
134 } while (curtag != null && curtag != ancestor);