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) {
54 sind = "<span style=\"background-color:#f0f0f0;\">";
55 for (i = 0 ; i < ind ; i++) {
60 if (typeof(s[i]) == 'string' || typeof(s[i]) == "function") {
62 var arr = this.escapeHTML(s[i]).split("\n");
64 ret += sind + arr[el] + "\n";
66 // this.div.innerHTML += "xx["+this.escapeHTML(i) + "] : [" + ret + "]<hr style=\"height: 1px; width: 100px;\"><br>\n";
67 this.div.innerHTML += this.escapeHTML(i)+"<br>\n";
68 this.div.innerHTML += ret + "<hr style=\"height: 1px; width: 100px;\"><br>\n";
71 this.dump_obj(s[i], ind+4);
74 // this.div.innerHTML += "post-loop<br>";
81 this.div.innerHTML += s + "<br>";
82 this.win.document.body.scrollTop = 10000000;
95 var is_xynt_console = false;
96 var console_enable = true;
98 if(typeof(console) == "undefined") {
101 console = new xynt_console(console_enable);
103 is_xynt_console = true;
106 // console.logger = console.log;
107 // console.log = function () { return 0; }
110 function deconsole() {
111 if (is_xynt_console) {
116 function log_walk(curtag)
119 var ancestor = curtag;
121 console.log(spcs("_", "+", ind)+" ["+curtag.tagName+"] nodeType: "+curtag.nodeType+" inner: ["+curtag.innerHTML+"]");
122 if (curtag.firstChild != null && curtag.tagName != "TD") {
124 curtag = curtag.firstChild;
126 else if (curtag.nextSibling != null) {
127 curtag = curtag.nextSibling;
129 else if (curtag.parentNode.nextSibling != null) {
131 curtag = curtag.parentNode.nextSibling;
135 } while (curtag != null && curtag != ancestor);