X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Fmyconsole.js;fp=web%2Fmyconsole.js;h=4d47f4d8a3c767649fe1419748014e940dac6664;hb=29d268c228f3bbea50358d0f489e1f434c078d21;hp=0000000000000000000000000000000000000000;hpb=9dcd78d3b648dd4a73fb6c6c7ff0fa1f40724862;p=brisk.git
diff --git a/web/myconsole.js b/web/myconsole.js
new file mode 100644
index 0000000..4d47f4d
--- /dev/null
+++ b/web/myconsole.js
@@ -0,0 +1,89 @@
+function myconsole(ena) {
+ var conbody, condiv;
+
+ this.enable = ena;
+ if (ena) {
+ this.win = window.open("","","scrollbars=yes,height=500,width=400,left=0,top=800");
+ conbody = this.win.document.createElement("body");
+ this.div = condiv = this.win.document.createElement("div");
+
+ conbody.id = "console_body";
+ this.win.document.body.appendChild(condiv);
+ }
+}
+
+myconsole.prototype = {
+ win: null,
+ div: null,
+ enable: false,
+
+ log: function(s) {
+ if (!this.enable) {
+ return;
+ }
+ this.div.innerHTML += s + "
";
+ this.win.document.body.scrollTop = 10000000;
+ },
+
+ logger: function(s) {
+ if (!this.enable) {
+ return;
+ }
+ this.div.innerHTML += s + "
";
+ this.win.document.body.scrollTop = 10000000;
+ },
+
+ close: function() {
+ if (this.enable) {
+ this.win.close();
+ }
+ }
+}
+
+/*
+ * create and destroy
+ */
+var ismyconsole = false;
+var console_enable = true;
+
+if(typeof(console) == "undefined") {
+ var console;
+
+ console = new myconsole(console_enable);
+
+ ismyconsole = true;
+}
+else {
+ // console.logger = console.log;
+ // console.log = function () { return 0; }
+}
+
+function deconsole() {
+ if (ismyconsole) {
+ console.close();
+ }
+}
+
+function log_walk(curtag)
+{
+ var ind = 0;
+ var ancestor = curtag;
+ do {
+ console.log(spcs("_", "+", ind)+" ["+curtag.tagName+"] nodeType: "+curtag.nodeType+" inner: ["+curtag.innerHTML+"]");
+ if (curtag.firstChild != null && curtag.tagName != "TD") {
+ ind += 2;
+ curtag = curtag.firstChild;
+ }
+ else if (curtag.nextSibling != null) {
+ curtag = curtag.nextSibling;
+ }
+ else if (curtag.parentNode.nextSibling != null) {
+ ind -= 2;
+ curtag = curtag.parentNode.nextSibling;
+ }
+ else
+ curtag = null;
+ } while (curtag != null && curtag != ancestor);
+}
+
+